Compare commits

...

2 commits

15 changed files with 152 additions and 6 deletions

View file

@ -2,12 +2,15 @@
# main # main
main_dc_name: columbia main_dc_name: columbia
# hashicorp defaults
hashi_arch: amd64
# consul # consul
consul_version: 1.8.4 consul_version: 1.9.1
consul_domain: masked.name consul_domain: masked.name
# vault # vault
vault_version: 1.5.2 vault_version: 1.6.1
vault_pki_policy: masked-dot-name vault_pki_policy: masked-dot-name
vault_ca_cert_name: MaskedName_Root_CA.crt vault_ca_cert_name: MaskedName_Root_CA.crt
vault_ca_cert_payload: | vault_ca_cert_payload: |
@ -56,9 +59,12 @@ vault_ca_cert_payload: |
-----END CERTIFICATE----- -----END CERTIFICATE-----
# nomad # nomad
nomad_version: 0.12.5 nomad_version: 1.0.1
nomad_podman_driver_version: 0.1.0 nomad_podman_driver_version: 0.1.0
# podman # podman
podman_version: 2.0.6+dfsg1-2 podman_version: 2.1.1+dfsg1-4
# lnd
lnd_version: v0.12.0-beta.rc3
... ...

View file

@ -0,0 +1,5 @@
---
hashi_arch: arm
consul_arch: armhfv6
lnd_arch: armv7
...

View file

@ -3,12 +3,16 @@ fatman.minhas.io
ivyking.minhas.io ivyking.minhas.io
ranger.minhas.io ranger.minhas.io
sedan.minhas.io sedan.minhas.io
redwingcherokee.minhas.io
[consul_server] [consul_server]
fatman.minhas.io fatman.minhas.io
ivyking.minhas.io ivyking.minhas.io
sedan.minhas.io sedan.minhas.io
[lnd]
redwingcherokee.minhas.io
[nexus] [nexus]
ivyking.minhas.io ivyking.minhas.io

View file

@ -0,0 +1,7 @@
---
- hosts: lnd
roles:
- role: tor
- role: bitcoind
- role: lnd
...

View file

@ -5,4 +5,5 @@
- import_playbook: consul-client.yml - import_playbook: consul-client.yml
- import_playbook: nomad.yml - import_playbook: nomad.yml
- import_playbook: nexus.yml - import_playbook: nexus.yml
- import_playbook: lnd.yml
... ...

View file

@ -0,0 +1,17 @@
[Unit]
Description=Bitcoin daemon
[Service]
ExecStartPre=/bin/sh -c 'sleep 30'
ExecStart=/usr/bin/bitcoind -daemon -conf=/home/bitcoind/.bitcoin/bitcoin.conf -pid=/home/bitcoind/.bitcoin/bitcoind.pid
PIDFile=/home/bitcoind/.bitcoin/bitcoind.pid
User=bitcoind
Group=bitcoind
Type=forking
KillMode=process
Restart=always
TimeoutSec=120
RestartSec=30
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,5 @@
---
- name: reload systemd
systemd:
daemon_reload: True
...

View file

@ -0,0 +1,53 @@
---
- name: create bitcoind group
group:
name: bitcoind
state: present
- name: create bitcoind user
user:
name: bitcoind
group: bitcoind
state: present
shell: /bin/bash
home: /home/bitcoind
- name: ensure bitcoind config directory exists
file:
path: /home/bitcoind/.bitcoin
state: directory
owner: bitcoind
group: bitcoind
mode: '0750'
- name: ensure bitcoind mount exists
mount:
path: /home/bitcoind/.bitcoin
src: /dev/sda1
fstype: ext4
opts: defaults
state: present
- name: install bitcoind
apt:
name: bitcoind
state: present
- name: ensure bitcoind service file exists
copy:
src: files/bitcoind.service
dest: /etc/systemd/system/bitcoind.service
mode: 0755
owner: root
group: root
notify: reload systemd
- name: flush handlers for systemd reloading
meta: flush_handlers
- name: ensure bitcoind is enabled and started
systemd:
name: bitcoind
state: started
enabled: True
...

View file

@ -14,10 +14,12 @@
- name: install default packages - name: install default packages
apt: apt:
name: name:
- acl
- dbus - dbus
- git - git
- htop - htop
- inxi - inxi
- make
- ncdu - ncdu
- netcat - netcat
- ntp - ntp
@ -27,6 +29,7 @@
- sysstat - sysstat
- tmux - tmux
- tree - tree
- unzip
- vim - vim
state: present state: present

View file

@ -25,7 +25,7 @@
- name: get vault - name: get vault
unarchive: unarchive:
src: "https://releases.hashicorp.com/vault/{{ vault_version }}/vault_{{ vault_version }}_linux_amd64.zip" src: "https://releases.hashicorp.com/vault/{{ vault_version }}/vault_{{ vault_version }}_linux_{{ hashi_arch }}.zip"
dest: /usr/local/bin/ dest: /usr/local/bin/
mode: 0755 mode: 0755
owner: root owner: root

View file

@ -1,3 +1,4 @@
--- ---
consul_config_path: /etc/consul.d consul_config_path: /etc/consul.d
consul_arch: '{{ hashi_arch }}'
... ...

View file

@ -55,7 +55,7 @@
- name: get consul - name: get consul
unarchive: unarchive:
src: "https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_linux_amd64.zip" src: "https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_linux_{{ consul_arch }}.zip"
dest: /usr/local/bin/ dest: /usr/local/bin/
mode: 0755 mode: 0755
owner: root owner: root

View file

@ -0,0 +1,3 @@
---
lnd_arch: amd64
...

View file

@ -0,0 +1,30 @@
---
- name: ensure go/bin dir exists for bitcoind user
file:
path: /home/bitcoind/go/bin
state: directory
owner: bitcoind
group: bitcoind
mode: 0750
- name: check if lnd is installed
stat:
path: /home/bitcoind/go/bin/lnd
register: lnd_binary
- name: check lnd version
shell: /home/bitcoind/go/bin/lnd --version | cut -d ' ' -f3
when: lnd_binary.stat.exists
changed_when: False
register: lnd_installed_version
- name: update lnd
unarchive:
src: 'https://github.com/lightningnetwork/lnd/releases/download/{{ lnd_version }}/lnd-linux-{{ lnd_arch }}-{{ lnd_version }}.tar.gz'
dest: /home/bitcoind/go/bin/
owner: bitcoind
group: bitcoind
remote_src: True
extra_opts: [--strip-components=1]
when: (lnd_binary.stat.exists == False) or (lnd_version != lnd_installed_version)
...

View file

@ -0,0 +1,11 @@
---
- name: ensure tor exists
apt:
name: tor
state: present
- name: ensure tor is started and enabled
systemd:
name: tor
state: started
enabled: True