143 lines
4.3 KiB
YAML
143 lines
4.3 KiB
YAML
---
|
|
# tasks file for build
|
|
#
|
|
# /home/{{ ansible_user }}/.config/containers/systemd/bitcoin-node.container
|
|
- name: bitcoin - Check rpcauth
|
|
block:
|
|
- name: Generate rpcauth information if unset
|
|
register: rpcauth_raw
|
|
local_action:
|
|
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 - Write json values (user) to host inventory file
|
|
local_action:
|
|
module: ansible.builtin.lineinfile
|
|
path: hosts
|
|
search_string: "bitcoin_rpcuser="
|
|
line: "bitcoin_rpcuser={{rpcauth_json.username}}"
|
|
insertafter: "^[{{ansible_hostname}}:vars]"
|
|
|
|
- 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]"
|
|
|
|
- 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))
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Create bitcoin-pod
|
|
containers.podman.podman_pod:
|
|
name: bitcoin-pod
|
|
state: started
|
|
ports:
|
|
- "50001:50001"
|
|
- "4224:4224"
|
|
- "127.0.0.1:8332:8332"
|
|
- "8333:8333"
|
|
- "9735:9735"
|
|
- "3010:3010"
|
|
- "3000:3000"
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Create bitcoin data / conf directory
|
|
ansible.builtin.file:
|
|
path: ~/vol/bitcoin/.bitcoin
|
|
state: directory
|
|
mode: '0755'
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Create .config/containers/systemd directory
|
|
ansible.builtin.file:
|
|
path: ~/.config/containers/systemd
|
|
state: directory
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Copy bitcoin-node.container file
|
|
ansible.builtin.template:
|
|
src: bitcoin/bitcoin-node.container.j2
|
|
dest: ~/containers/bitcoin/bitcoin-node.container
|
|
notify:
|
|
- reload_systemctl
|
|
- restart_bitcoin
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Link bitcoin-node.container to systemd location
|
|
ansible.builtin.file:
|
|
src: ~/containers/bitcoin/bitcoin-node.container
|
|
dest: ~/.config/containers/systemd/bitcoin-node.container
|
|
state: link
|
|
force: true
|
|
|
|
- name: bitcoin - Create containers/bitcoin Dir
|
|
ansible.builtin.file:
|
|
path: ~/containers/bitcoin/bin
|
|
recurse: true
|
|
state: directory
|
|
notify: rebuild_bitcoin
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Copy containerfile Template
|
|
ansible.builtin.copy:
|
|
src: bitcoin/Containerfile
|
|
dest: ~/containers/bitcoin/Containerfile
|
|
notify: rebuild_bitcoin
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Copy entrypoint.sh
|
|
ansible.builtin.copy:
|
|
src: bitcoin/entrypoint.sh
|
|
dest: ~/containers/bitcoin/entrypoint.sh
|
|
notify: rebuild_bitcoin
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Copy btc_init
|
|
ansible.builtin.copy:
|
|
src: bitcoin/bin/btc_init
|
|
dest: ~/containers/bitcoin/bin/btc_init
|
|
notify: rebuild_bitcoin
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Copy btc_oneshot
|
|
ansible.builtin.template:
|
|
src: bitcoin/bin/btc_oneshot.j2
|
|
dest: ~/containers/bitcoin/bin/btc_oneshot
|
|
notify: rebuild_bitcoin
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - Copy build script
|
|
ansible.builtin.template:
|
|
src: bitcoin/build.sh.j2
|
|
dest: ~/containers/bitcoin/build.sh
|
|
mode: '0700'
|
|
notify: rebuild_bitcoin
|
|
tags: [apps,bitcoin]
|
|
|
|
- name: bitcoin - copy rpcauth.py utility
|
|
ansible.builtin.copy:
|
|
src: bitcoin/rpcauth.py
|
|
dest: ~/containers/bitcoin/rpcauth.py
|
|
mode: '0700'
|
|
tags: [apps,bitcoin]
|