fixups on task blocks for bitcoin....also create run.sh script for clightning
This commit is contained in:
parent
d39cd9dd74
commit
d04e8526ce
@ -1,47 +1,44 @@
|
|||||||
---
|
---
|
||||||
# tasks file for build
|
# tasks file for build
|
||||||
#
|
#
|
||||||
- name: bitcoin - Generate rpcauth information if unset
|
- name: bitcoin - Check rpcauth
|
||||||
|
block:
|
||||||
|
- name: Generate rpcauth information if unset
|
||||||
register: rpcauth_raw
|
register: rpcauth_raw
|
||||||
local_action:
|
local_action:
|
||||||
module: ansible.builtin.shell
|
module: ansible.builtin.shell
|
||||||
cmd: python roles/apps/files/bitcoin/rpcauth.py -json {{ansible_hostname}}
|
cmd: python roles/apps/files/bitcoin/rpcauth.py -json {{ansible_hostname}}
|
||||||
when: ((bitcoin_rpcuser is defined) and (bitcoin_rpcuser|length==0)) or ((bitcoin_rpcpassword is defined) and (bitcoin_rpcpassword|length==0)) or ((bitcoin_rpcauth is defined) and (bitcoin_rpcauth|length==0))
|
|
||||||
|
|
||||||
- name: bitcoin - Parse raw rpcauth info into json
|
- name: bitcoin - Parse raw rpcauth info into json
|
||||||
local_action:
|
local_action:
|
||||||
module: ansible.builtin.set_fact
|
module: ansible.builtin.set_fact
|
||||||
rpcauth_json: "{{ rpcauth_raw.stdout | from_json }}"
|
rpcauth_json: "{{ rpcauth_raw.stdout | from_json }}"
|
||||||
when: ((bitcoin_rpcuser is defined) and (bitcoin_rpcuser|length==0)) or ((bitcoin_rpcpassword is defined) and (bitcoin_rpcpassword|length==0)) or ((bitcoin_rpcauth is defined) and (bitcoin_rpcauth|length==0))
|
|
||||||
|
|
||||||
- name: bitcoin - Write json values (user) to host inventory file
|
- name: bitcoin - Write json values (user) to host inventory file
|
||||||
local_action:
|
local_action:
|
||||||
module: ansible.builtin.lineinfile
|
module: ansible.builtin.lineinfile
|
||||||
path: hosts
|
path: hosts
|
||||||
search_string: "bitcoin_rpcuser="
|
search_string: "bitcoin_rpcuser="
|
||||||
line: "bitcoin_rpcuser={{rpcauth_json.username}}"
|
line: "bitcoin_rpcuser={{rpcauth_json.username}}"
|
||||||
insertafter: "^[{{ansible_hostname}}:vars]"
|
insertafter: "^[{{ansible_hostname}}:vars]"
|
||||||
when: ((bitcoin_rpcuser is defined) and (bitcoin_rpcuser|length==0)) or ((bitcoin_rpcpassword is defined) and (bitcoin_rpcpassword|length==0)) or ((bitcoin_rpcauth is defined) and (bitcoin_rpcauth|length==0))
|
|
||||||
|
|
||||||
- name: bitcoin - Write json values (password) to host inventory file
|
- name: bitcoin - Write json values (password) to host inventory file
|
||||||
local_action:
|
local_action:
|
||||||
module: ansible.builtin.lineinfile
|
module: ansible.builtin.lineinfile
|
||||||
path: hosts
|
path: hosts
|
||||||
search_string: "bitcoin_rpcpassword="
|
search_string: "bitcoin_rpcpassword="
|
||||||
line: "bitcoin_rpcpassword={{rpcauth_json.password}}"
|
line: "bitcoin_rpcpassword={{rpcauth_json.password}}"
|
||||||
insertafter: "^[{{ansible_hostname}}:vars]"
|
insertafter: "^[{{ansible_hostname}}:vars]"
|
||||||
when: ((bitcoin_rpcuser is defined) and (bitcoin_rpcuser|length==0)) or ((bitcoin_rpcpassword is defined) and (bitcoin_rpcpassword|length==0)) or ((bitcoin_rpcauth is defined) and (bitcoin_rpcauth|length==0))
|
|
||||||
|
|
||||||
- name: bitcoin - Write json values (auth) to host inventory file
|
- name: bitcoin - Write json values (auth) to host inventory file
|
||||||
local_action:
|
local_action:
|
||||||
module: ansible.builtin.lineinfile
|
module: ansible.builtin.lineinfile
|
||||||
path: hosts
|
path: hosts
|
||||||
search_string: "bitcoin_rpcauth="
|
search_string: "bitcoin_rpcauth="
|
||||||
line: "bitcoin_rpcauth={{rpcauth_json.rpcauth}}"
|
line: "bitcoin_rpcauth={{rpcauth_json.rpcauth}}"
|
||||||
insertafter: "^[{{ansible_hostname}}:vars]"
|
insertafter: "^[{{ansible_hostname}}:vars]"
|
||||||
when: ((bitcoin_rpcuser is defined) and (bitcoin_rpcuser|length==0)) or ((bitcoin_rpcpassword is defined) and (bitcoin_rpcpassword|length==0)) or ((bitcoin_rpcauth is defined) and (bitcoin_rpcauth|length==0))
|
|
||||||
|
|
||||||
- name: bitcoin - Reset local rpc user/auth facts if they changed
|
- name: bitcoin - Reset local rpc user/auth facts if they changed
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
bitcoin_rpcuser: "{{rpcauth_json.username}}"
|
bitcoin_rpcuser: "{{rpcauth_json.username}}"
|
||||||
bitcoin_rpcpassword: "{{ rpcauth_json.password }}"
|
bitcoin_rpcpassword: "{{ rpcauth_json.password }}"
|
||||||
|
|||||||
@ -4,7 +4,7 @@ Description=Core Lightning Server
|
|||||||
[Container]
|
[Container]
|
||||||
Image={{ registry_url }}/clightning:{{ clightning_version }}
|
Image={{ registry_url }}/clightning:{{ clightning_version }}
|
||||||
PodmanArgs=--pod bitcoin-pod
|
PodmanArgs=--pod bitcoin-pod
|
||||||
Exec=--bitcoin-rpcuser={{bitcoin_rpcuser}} --bitcoin-rpcpassword={{bitcoin_rpcpassword}}
|
Exec=--bitcoin-rpcuser={{bitcoin_rpcuser}} --bitcoin-rpcpassword={{bitcoin_rpcpassword}} --wallet=sqlite3://root/.lightning/bitcoin/lightningd.sqlite3 --clnrest-port=3010
|
||||||
|
|
||||||
# Use volume
|
# Use volume
|
||||||
Volume=/home/{{ansible_user}}/.bitcoin:/data/.bitcoin:ro,Z
|
Volume=/home/{{ansible_user}}/.bitcoin:/data/.bitcoin:ro,Z
|
||||||
|
|||||||
1
roles/apps/templates/clightning/run.sh.j2
Normal file
1
roles/apps/templates/clightning/run.sh.j2
Normal file
@ -0,0 +1 @@
|
|||||||
|
podman run -it --rm --name clightning-node -v ~/.bitcoin:/data/.bitcoin:ro,Z -v ~/.lightning:/data/.lightning:Z clightning-node:{{clightning_version}} --bitcoin-rpcuser={{bitcoin_rpcuser}} --bitcoin-rpcpassword={{bitcoin_rpcpassword}}
|
||||||
@ -90,12 +90,12 @@
|
|||||||
enabled: false
|
enabled: false
|
||||||
masked: true
|
masked: true
|
||||||
|
|
||||||
#- name: Set {{ ansible_user }} user to linger
|
- name: Set {{ ansible_user }} user to linger
|
||||||
#become: true
|
become: true
|
||||||
#become_method: sudo
|
become_method: sudo
|
||||||
#command: loginctl enable-linger {{ ansible_user }}
|
ansible.builtin.shell:
|
||||||
#args:
|
cmd: loginctl enable-linger {{ ansible_user }}
|
||||||
#creates: /var/lib/systemd/linger/{{ ansible_user }}
|
creates: /var/lib/systemd/linger/{{ ansible_user }}
|
||||||
|
|
||||||
- name: Set update zincati wariness to {{update_wariness}}
|
- name: Set update zincati wariness to {{update_wariness}}
|
||||||
become: true
|
become: true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user