infra/ansible/roles/lnd/tasks/main.yml

53 lines
1.3 KiB
YAML
Raw Normal View History

2021-01-08 01:02:04 +00:00
---
- 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
2021-02-26 04:41:37 +00:00
- name: stop lnd
systemd:
name: lnd
state: stopped
when: (lnd_binary.stat.exists == False) or (lnd_version != lnd_installed_version.stdout)
2021-07-30 03:48:23 +00:00
- name: remove old lnd files
file:
name: "/home/bitcoind/go/bin/{{ item }}"
state: absent
with_items:
- lncli
- lnd
2021-08-10 05:17:31 +00:00
when: (lnd_binary.stat.exists == False) or (lnd_version != lnd_installed_version.stdout)
2021-07-30 03:48:23 +00:00
2021-01-08 01:02:04 +00:00
- name: update lnd
unarchive:
2021-07-30 03:48:23 +00:00
src: "https://github.com/lightningnetwork/lnd/releases/download/v{{ lnd_version }}/lnd-linux-{{ lnd_arch }}-v{{ lnd_version }}.tar.gz"
2021-02-26 04:41:37 +00:00
dest: /home/bitcoind/go/bin
2021-01-08 01:02:04 +00:00
owner: bitcoind
group: bitcoind
2021-02-26 04:41:37 +00:00
list_files: True
2021-01-08 01:02:04 +00:00
remote_src: True
extra_opts: [--strip-components=1]
2021-02-26 04:41:37 +00:00
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
2021-01-08 01:02:04 +00:00
...