bitcoind/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 07 Jun 2020 11:11:08 -0500
changeset 10 26ed67281db6
parent 9 ddf84e986362
child 21 bf53e2eb4d30
permissions -rw-r--r--
Updated bitcoind and lnd.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: add bitcoind user
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  user: name="{{bitcoind_user}}"
9934a00b9e97 Added bitcoind ansible
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 bitcoind
4
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  unarchive:
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
    remote_src: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
    src: "{{bitcoind_url}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
    dest: "/tmp"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
    creates: "/tmp/bitcoin-{{bitcoind_version}}/"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
- name: install bitcoind
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  copy:
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
    src: "/tmp/bitcoin-{{bitcoind_version}}/bin/{{item}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
    dest: "/usr/local/bin/"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
    remote_src: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
    owner: "root"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
    group: "root"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
    mode: "0755"
6
e0672e50e2c5 Moved from with_items to loop.
Luke Hoersten <luke@hoersten.org>
parents: 4
diff changeset
    24
  loop:
4
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
    - "bitcoind"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
    - "bitcoin-cli"
10
26ed67281db6 Updated bitcoind and lnd.
Luke Hoersten <luke@hoersten.org>
parents: 9
diff changeset
    27
  notify: restart bitcoind
4
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
- name: create bitcoind data dir
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
  file:
9
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    32
    path: "{{item.path}}"
4
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
    state: "directory"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
    owner: "{{bitcoind_user}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
    group: "{{bitcoind_user}}"
9
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    36
    mode: "{{item.mode}}"
6
e0672e50e2c5 Moved from with_items to loop.
Luke Hoersten <luke@hoersten.org>
parents: 4
diff changeset
    37
  loop:
9
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    38
    - { path: "{{bitcoind_data_dir}}", mode: "0750" }
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    39
    - { path: "{{bitcoind_log_dir}}", mode: "0750" }
ddf84e986362 Added bitcoind-prometheus-exporter role.
Luke Hoersten <luke@hoersten.org>
parents: 6
diff changeset
    40
    - { path: "{{bitcoind_conf_dir}}", mode: "0755" }
4
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
- name: configure bitcoind
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
  template:
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
    src: "bitcoin.conf.j2"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
    dest: "{{bitcoind_conf_dir}}/bitcoin.conf"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    47
    owner: "{{bitcoind_user}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    48
    group: "{{bitcoind_user}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    49
    mode: "0644"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    50
  notify: restart bitcoind
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    51
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    52
- name: install bitcoind service
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
  template:
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
    src: "bitcoind.service.j2"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
    dest: "/lib/systemd/system/bitcoind.service"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
    mode: "0644"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    58
  notify: restart bitcoind
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    59
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    60
- name: ensure bitcoind is started
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    61
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    62
  systemd: service="bitcoind.service" enabled="yes" state="started" daemon_reload="yes"