53 lines
1.3 KiB
YAML
53 lines
1.3 KiB
YAML
---
|
|
- 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: stop lnd
|
|
systemd:
|
|
name: lnd
|
|
state: stopped
|
|
when: (lnd_binary.stat.exists == False) or (lnd_version != lnd_installed_version.stdout)
|
|
|
|
- name: remove old lnd files
|
|
file:
|
|
name: "/home/bitcoind/go/bin/{{ item }}"
|
|
state: absent
|
|
with_items:
|
|
- lncli
|
|
- lnd
|
|
when: (lnd_binary.stat.exists == False) or (lnd_version != lnd_installed_version.stdout)
|
|
|
|
- name: update lnd
|
|
unarchive:
|
|
src: "https://github.com/lightningnetwork/lnd/releases/download/v{{ lnd_version }}/lnd-linux-{{ lnd_arch }}-v{{ lnd_version }}.tar.gz"
|
|
dest: /home/bitcoind/go/bin
|
|
owner: bitcoind
|
|
group: bitcoind
|
|
list_files: True
|
|
remote_src: True
|
|
extra_opts: [--strip-components=1]
|
|
when: (lnd_binary.stat.exists == False) or (lnd_version != lnd_installed_version.stdout)
|
|
|
|
- name: ensure lnd is started
|
|
systemd:
|
|
name: lnd
|
|
state: started
|
|
enabled: true
|
|
...
|