bitcoind-prometheus-exporter/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 02 Aug 2020 14:53:10 -0500
changeset 12 35e84fe5a98a
parent 9 ddf84e986362
child 35 f7dc2fa74e74
permissions -rw-r--r--
Added readme
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: apt-get bitcoind-prometheus-exporter install deps
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  apt: name="python3-pip"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: pip bitcoind-prometheus-exporter install deps
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  pip: name="{{item}}"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
  loop:
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    - "riprova"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    - "prometheus_client"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
    - "python-bitcoinlib"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
- name: unarchive bitcoind-prometheus-exporter
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  become: yes
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  unarchive:
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    remote_src: yes
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    src: "{{bitcoind_prometheus_exporter_url}}"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    dest: "/tmp"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
    creates: "/tmp/{{bitcoind_prometheus_exporter_tar_name}}/"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
  notify: restart service
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
- name: install bitcoind-prometheus-exporter
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
  become: yes
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
  copy:
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
    src: "/tmp/{{bitcoind_prometheus_exporter_tar_name}}/bitcoind-monitor.py"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
    dest: "/usr/local/bin/bitcoind-prometheus-exporter.py"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    remote_src: yes
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
    owner: "root"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
    group: "root"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
    mode: "0755"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
  changed_when: false
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
- name: install bitcoind-prometheus-exporter service
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  become: yes
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
  template:
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
    src: "bitcoind-prometheus-exporter.service.j2"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
    dest: "/lib/systemd/system/bitcoind-prometheus-exporter.service"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
    mode: "0644"
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
  notify: restart service
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
- name: ensure bitcoind-prometheus-exporter service is started
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
  become: yes
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
  systemd: service="bitcoind-prometheus-exporter.service" enabled="yes" state="started" daemon_reload="yes"