Initial commit of btcd and lnd roles.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/btcd/defaults/main.yaml Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,8 @@
+---
+
+btcd_user: "{{node_user}}"
+btcd_version: "v0.20.1-beta"
+btcd_tar_name: "btcd-linux-armv7-{{btcd_version}}"
+btcd_tar: "{{btcd_tar_name}}.tar.gz"
+btcd_url: "https://github.com/btcsuite/btcd/releases/download/{{btcd_version}}/{{btcd_tar}}"
+btcd_enable_txindex: true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/btcd/meta/main.yaml Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,17 @@
+---
+
+dependencies:
+ - role: node/install
+ vars:
+ node_install_user: "{{btcd_user}}"
+ node_install_url: "{{btcd_url}}"
+ node_install_tar: "{{btcd_tar}}"
+ node_install_tar_name: "{{btcd_tar_name}}"
+
+ - role: node/conf
+ vars:
+ node_type: "btcd"
+ node_conf_template: "btcd.conf.j2"
+ node_service_template: "btcd.service.j2"
+ node_data_dir: "{{btcd_data_dir}}"
+ node_log_dir: "{{btcd_log_dir}}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/btcd/templates/btcd.conf.j2 Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,8 @@
+[Application Options]
+datadir={{btcd_data_dir}}
+logdir={{btcd_log_dir}}
+
+rpcuser={{btcd_rpc_user}}
+rpcpass={{btcd_rpc_pass}}
+
+txindex={{btcd_enable_txindex}}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/btcd/templates/btcd.service.j2 Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,17 @@
+[Unit]
+Description=btcd
+After=network.target
+
+[Service]
+ExecStart=/usr/local/bin/btcd
+User={{btcd_user}}
+Restart=on-failure
+
+PrivateTmp=true
+ProtectSystem=full
+NoNewPrivileges=true
+PrivateDevices=true
+MemoryDenyWriteExecute=true
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lnd/defaults/main.yaml Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,13 @@
+---
+
+lnd_user: "{{node_user}}"
+lnd_version: "v0.10.0-beta.rc5"
+lnd_tar_name: "lnd-linux-armv7-{{lnd_version}}"
+lnd_tar: "{{lnd_tar_name}}.tar.gz"
+lnd_url: "https://github.com/lightningnetwork/lnd/releases/download/{{lnd_version}}/{{lnd_tar}}"
+
+lndconnect_user: "{{node_user}}"
+lndconnect_version: "v0.2.0"
+lndconnect_tar_name: "lndconnect-linux-armv7-{{lndconnect_version}}"
+lndconnect_tar: "{{lndconnect_tar_name}}.tar.gz"
+lndconnect_url: "https://github.com/LN-Zap/lndconnect/releases/download/{{lndconnect_version}}/{{lndconnect_tar}}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lnd/meta/main.yaml Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,24 @@
+---
+
+dependencies:
+ - role: node/install
+ vars:
+ node_install_user: "{{lnd_user}}"
+ node_install_url: "{{lnd_url}}"
+ node_install_tar: "{{lnd_tar}}"
+ node_install_tar_name: "{{lnd_tar_name}}"
+
+ - role: node/install
+ vars:
+ node_install_user: "{{lndconnect_user}}"
+ node_install_url: "{{lndconnect_url}}"
+ node_install_tar: "{{lndconnect_tar}}"
+ node_install_tar_name: "{{lndconnect_tar_name}}"
+
+ - role: node/conf
+ vars:
+ node_type: "lnd"
+ node_conf_template: "lnd.conf.j2"
+ node_service_template: "lnd.service.j2"
+ node_data_dir: "{{lnd_data_dir}}"
+ node_log_dir: "{{lnd_log_dir}}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lnd/templates/lnd.conf.j2 Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,17 @@
+[Application Options]
+datadir={{lnd_data_dir}}
+logdir={{lnd_log_dir}}
+
+alias={{lnd_alias}}
+; color=#3399FF
+
+tlsextradomain={{lnd_alias}}
+rpclisten=0.0.0.0:10009
+externalip={{lnd_external_ip}}
+
+debuglevel=trace
+
+[Bitcoin]
+bitcoin.mainnet=true
+bitcoin.active=true
+bitcoin.node={{lnd_bitcoin_node}}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lnd/templates/lnd.service.j2 Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,18 @@
+[Unit]
+Description=lnd
+Wants=btcd.service
+After=btcd.service
+
+[Service]
+ExecStart=/usr/local/bin/lnd
+User={{lnd_user}}
+Restart=on-failure
+
+PrivateTmp=true
+ProtectSystem=full
+NoNewPrivileges=true
+PrivateDevices=true
+MemoryDenyWriteExecute=true
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/node/conf/defaults/main.yaml Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,3 @@
+---
+
+node_conf_dir: "/home/{{node_user}}/.{{node_type}}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/node/conf/handlers/main.yaml Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,5 @@
+---
+
+- name: restart node
+ become: yes
+ systemd: service="{{node_type}}.service" state="restarted" daemon_reload="yes"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/node/conf/tasks/main.yaml Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,36 @@
+---
+
+- name: create node data dir
+ become: yes
+ file:
+ path: "{{item}}"
+ state: "directory"
+ owner: "{{node_user}}"
+ group: "{{node_user}}"
+ mode: "0770"
+ with_items:
+ - "{{node_data_dir}}"
+ - "{{node_log_dir}}"
+ - "{{node_conf_dir}}"
+
+- name: install conf
+ become: yes
+ template:
+ src: "{{node_conf_template}}"
+ dest: "{{node_conf_dir}}/{{node_type}}.conf"
+ owner: "{{node_user}}"
+ group: "{{node_user}}"
+ mode: "0770"
+ notify: restart node
+
+- name: install node service
+ become: yes
+ template:
+ src: "{{node_service_template}}"
+ dest: "/lib/systemd/system/{{node_type}}.service"
+ mode: "0644"
+ notify: restart node
+
+- name: ensure node is started
+ become: yes
+ systemd: service="{{node_type}}.service" enabled="yes" state="started" daemon_reload="yes"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/node/install/tasks/main.yaml Mon Apr 27 11:17:52 2020 -0500
@@ -0,0 +1,24 @@
+---
+
+- name: add node user
+ become: yes
+ user: name="{{node_install_user}}"
+
+- name: download node
+ become: yes
+ get_url:
+ url: "{{node_install_url}}"
+ dest: "/tmp/{{node_install_tar}}"
+
+- name: unarchive node
+ become: yes
+ unarchive:
+ remote_src: "yes"
+ src: "/tmp/{{node_install_tar}}"
+ dest: "/tmp"
+ creates: "/tmp/{{node_install_tar_name}}/"
+
+- name: install node
+ become: yes
+ shell: "install -m 0755 -o {{node_install_user}} -g {{node_install_user}} -t /usr/local/bin /tmp/{{node_install_tar_name}}/*"
+ changed_when: false