lnd/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 05 Sep 2022 16:03:32 -0500
changeset 25 c2bab619cfb5
parent 21 bf53e2eb4d30
child 27 3abee15898bb
permissions -rw-r--r--
Added REST api and cleaned up service unit file.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: add lnd user
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
21
bf53e2eb4d30 Updated versions.
Luke Hoersten <luke@hoersten.org>
parents: 10
diff changeset
     5
  user: name="{{lnd_user}}" shell="/bin/false" system="yes"
5
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
10
26ed67281db6 Updated bitcoind and lnd.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
     7
- name: download lnd
5
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  unarchive:
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    remote_src: yes
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    src: "{{item.url}}"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    dest: "/tmp"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
    creates: "/tmp/{{item.tar_name}}/"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
  loop:
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
    - url: "{{lnd_url}}"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
      tar_name: "{{lnd_tar_name}}"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
    - url: "{{lndconnect_url}}"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
      tar_name: "{{lndconnect_tar_name}}"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
- name: install lnd
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
  become: yes
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
  copy:
10
26ed67281db6 Updated bitcoind and lnd.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
    23
    src: "/tmp/{{item.tar}}/{{item.bin}}"
26ed67281db6 Updated bitcoind and lnd.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
    24
    dest: "/usr/local/bin/"
5
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
    remote_src: yes
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
    owner: "root"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
    group: "root"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
    mode: "0755"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
  loop:
10
26ed67281db6 Updated bitcoind and lnd.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
    30
    - { tar: "{{lnd_tar_name}}", bin: "lnd" }
26ed67281db6 Updated bitcoind and lnd.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
    31
    - { tar: "{{lnd_tar_name}}", bin: "lncli" }
26ed67281db6 Updated bitcoind and lnd.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
    32
    - { tar: "{{lndconnect_tar_name}}", bin: "lndconnect" }
26ed67281db6 Updated bitcoind and lnd.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
    33
  notify: restart lnd
5
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
- name: create lnd data dir
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  become: yes
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
  file:
9
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    38
    path: "{{item.path}}"
5
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
    state: "directory"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
    owner: "{{lnd_user}}"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
    group: "{{lnd_user}}"
9
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    42
    mode: "{{item.mode}}"
6
e0672e50e2c5 Moved from with_items to loop.
Luke Hoersten <luke@hoersten.org>
parents: 5
diff changeset
    43
  loop:
9
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    44
    - { path: "{{lnd_data_dir}}", mode: "0750" }
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    45
    - { path: "{{lnd_log_dir}}", mode: "0750" }
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    46
    - { path: "{{lnd_conf_dir}}", mode: "0755" }
5
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    47
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    48
- name: configure lnd
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    49
  become: yes
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    50
  template:
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    51
    src: "lnd.conf.j2"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    52
    dest: "{{lnd_conf_dir}}/lnd.conf"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
    owner: "{{lnd_user}}"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
    group: "{{lnd_user}}"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
    mode: "0644"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
  notify: restart lnd
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    58
- name: install lnd service
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    59
  become: yes
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    60
  template:
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    61
    src: "lnd.service.j2"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    62
    dest: "/lib/systemd/system/lnd.service"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    63
    mode: "0644"
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    64
  notify: restart lnd
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    65
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    66
- name: ensure lnd is started
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    67
  become: yes
5873b7e583d7 Removed btcd role and combined lnd role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    68
  systemd: service="lnd.service" enabled="yes" state="started" daemon_reload="yes"