bitcoind-prometheus-exporter/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 05 Jul 2021 10:46:30 -0500
changeset 19 5c8335b57353
parent 9 ddf84e986362
child 35 f7dc2fa74e74
permissions -rw-r--r--
Added lnd channel backup to s3 role.

---

- name: apt-get bitcoind-prometheus-exporter install deps
  become: yes
  apt: name="python3-pip"

- name: pip bitcoind-prometheus-exporter install deps
  become: yes
  pip: name="{{item}}"
  loop:
    - "riprova"
    - "prometheus_client"
    - "python-bitcoinlib"

- name: unarchive bitcoind-prometheus-exporter
  become: yes
  unarchive:
    remote_src: yes
    src: "{{bitcoind_prometheus_exporter_url}}"
    dest: "/tmp"
    creates: "/tmp/{{bitcoind_prometheus_exporter_tar_name}}/"
  notify: restart service

- name: install bitcoind-prometheus-exporter
  become: yes
  copy:
    src: "/tmp/{{bitcoind_prometheus_exporter_tar_name}}/bitcoind-monitor.py"
    dest: "/usr/local/bin/bitcoind-prometheus-exporter.py"
    remote_src: yes
    owner: "root"
    group: "root"
    mode: "0755"
  changed_when: false

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

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