|
|
@@ -1,51 +1,48 @@
|
|
|
|
---
|
|
|
|
---
|
|
|
|
# tasks file for build
|
|
|
|
# tasks file for build
|
|
|
|
#
|
|
|
|
#
|
|
|
|
- name: bitcoin - Generate rpcauth information if unset
|
|
|
|
- name: bitcoin - Check rpcauth
|
|
|
|
register: rpcauth_raw
|
|
|
|
block:
|
|
|
|
local_action:
|
|
|
|
- name: Generate rpcauth information if unset
|
|
|
|
module: ansible.builtin.shell
|
|
|
|
register: rpcauth_raw
|
|
|
|
cmd: python roles/apps/files/bitcoin/rpcauth.py -json {{ansible_hostname}}
|
|
|
|
local_action:
|
|
|
|
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))
|
|
|
|
module: ansible.builtin.shell
|
|
|
|
|
|
|
|
cmd: python roles/apps/files/bitcoin/rpcauth.py -json {{ansible_hostname}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: bitcoin - Parse raw rpcauth info into json
|
|
|
|
|
|
|
|
local_action:
|
|
|
|
|
|
|
|
module: ansible.builtin.set_fact
|
|
|
|
|
|
|
|
rpcauth_json: "{{ rpcauth_raw.stdout | from_json }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: bitcoin - Parse raw rpcauth info into json
|
|
|
|
- name: bitcoin - Write json values (user) to host inventory file
|
|
|
|
local_action:
|
|
|
|
local_action:
|
|
|
|
module: ansible.builtin.set_fact
|
|
|
|
module: ansible.builtin.lineinfile
|
|
|
|
rpcauth_json: "{{ rpcauth_raw.stdout | from_json }}"
|
|
|
|
path: hosts
|
|
|
|
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))
|
|
|
|
search_string: "bitcoin_rpcuser="
|
|
|
|
|
|
|
|
line: "bitcoin_rpcuser={{rpcauth_json.username}}"
|
|
|
|
- name: bitcoin - Write json values (user) to host inventory file
|
|
|
|
insertafter: "^[{{ansible_hostname}}:vars]"
|
|
|
|
local_action:
|
|
|
|
|
|
|
|
module: ansible.builtin.lineinfile
|
|
|
|
|
|
|
|
path: hosts
|
|
|
|
|
|
|
|
search_string: "bitcoin_rpcuser="
|
|
|
|
|
|
|
|
line: "bitcoin_rpcuser={{rpcauth_json.username}}"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
local_action:
|
|
|
|
|
|
|
|
module: ansible.builtin.lineinfile
|
|
|
|
|
|
|
|
path: hosts
|
|
|
|
|
|
|
|
search_string: "bitcoin_rpcpassword="
|
|
|
|
|
|
|
|
line: "bitcoin_rpcpassword={{rpcauth_json.password}}"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
local_action:
|
|
|
|
|
|
|
|
module: ansible.builtin.lineinfile
|
|
|
|
|
|
|
|
path: hosts
|
|
|
|
|
|
|
|
search_string: "bitcoin_rpcauth="
|
|
|
|
|
|
|
|
line: "bitcoin_rpcauth={{rpcauth_json.rpcauth}}"
|
|
|
|
|
|
|
|
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 - Write json values (password) to host inventory file
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
local_action:
|
|
|
|
bitcoin_rpcuser: "{{rpcauth_json.username}}"
|
|
|
|
module: ansible.builtin.lineinfile
|
|
|
|
bitcoin_rpcpassword: "{{ rpcauth_json.password }}"
|
|
|
|
path: hosts
|
|
|
|
bitcoin_rpcauth: "{{ rpcauth_json.rpcauth}}"
|
|
|
|
search_string: "bitcoin_rpcpassword="
|
|
|
|
|
|
|
|
line: "bitcoin_rpcpassword={{rpcauth_json.password}}"
|
|
|
|
|
|
|
|
insertafter: "^[{{ansible_hostname}}:vars]"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: bitcoin - Write json values (auth) to host inventory file
|
|
|
|
|
|
|
|
local_action:
|
|
|
|
|
|
|
|
module: ansible.builtin.lineinfile
|
|
|
|
|
|
|
|
path: hosts
|
|
|
|
|
|
|
|
search_string: "bitcoin_rpcauth="
|
|
|
|
|
|
|
|
line: "bitcoin_rpcauth={{rpcauth_json.rpcauth}}"
|
|
|
|
|
|
|
|
insertafter: "^[{{ansible_hostname}}:vars]"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: bitcoin - Reset local rpc user/auth facts if they changed
|
|
|
|
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
|
|
|
|
bitcoin_rpcuser: "{{rpcauth_json.username}}"
|
|
|
|
|
|
|
|
bitcoin_rpcpassword: "{{ rpcauth_json.password }}"
|
|
|
|
|
|
|
|
bitcoin_rpcauth: "{{ rpcauth_json.rpcauth}}"
|
|
|
|
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))
|
|
|
|
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 - Create bitcoin-pod
|
|
|
|
- name: bitcoin - Create bitcoin-pod
|
|
|
|