lnd/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 07 Oct 2024 23:30:59 -0500
changeset 36 8de33340cca9
parent 28 c94c54d5e61b
permissions -rw-r--r--
Added hacks to fix lnd bitcoind 28 bug.

---

- name: add lnd user
  become: yes
  user: name="{{lnd_user}}" shell="/bin/false" system="yes"

- name: download lnd
  become: yes
  unarchive:
    remote_src: yes
    src: "{{item.url}}"
    dest: "/tmp"
    creates: "/tmp/{{item.tar_name}}/"
  loop:
    - url: "{{lnd_url}}"
      tar_name: "{{lnd_tar_name}}"
    - url: "{{lndconnect_url}}"
      tar_name: "{{lndconnect_tar_name}}"

- name: install lnd
  become: yes
  copy:
    src: "{{item}}"
    dest: "/usr/local/bin/"
    remote_src: yes
    owner: "root"
    group: "root"
    mode: "0755"
  loop:
    - "/tmp/{{lnd_tar_name}}/lnd"
    - "/tmp/{{lnd_tar_name}}/lncli"
    - "/tmp/{{lndconnect_tar_name}}/lndconnect"
  notify: restart lnd

- name: install lnd-hex-macaroon script
  become: yes
  copy:
    src: "lnd-hex-macaroon"
    dest: "/usr/local/bin/"
    owner: "root"
    group: "root"
    mode: "0755"

- name: create lnd data dir
  become: yes
  file:
    path: "{{item.path}}"
    state: "directory"
    owner: "{{lnd_user}}"
    group: "{{lnd_user}}"
    mode: "{{item.mode}}"
  loop:
    - { path: "{{lnd_data_dir}}", mode: "0750" }
    - { path: "{{lnd_log_dir}}", mode: "0750" }
    - { path: "{{lnd_conf_dir}}", mode: "0755" }

- name: configure lnd
  become: yes
  template:
    src: "lnd.conf.j2"
    dest: "{{lnd_conf_dir}}/lnd.conf"
    owner: "{{lnd_user}}"
    group: "{{lnd_user}}"
    mode: "0644"
  notify: restart lnd

- name: install lnd service
  become: yes
  template:
    src: "lnd.service.j2"
    dest: "/lib/systemd/system/lnd.service"
    mode: "0644"
  notify: restart lnd

- name: ensure lnd is started
  become: yes
  systemd: service="lnd.service" enabled="yes" state="started" daemon_reload="yes"