bitcoind/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Tue, 12 May 2020 19:19:36 -0500
changeset 4 9934a00b9e97
child 6 e0672e50e2c5
permissions -rw-r--r--
Added bitcoind ansible
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
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: unarchive bitcoind
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"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
  with_items:
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"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
- name: create bitcoind data dir
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
  file:
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
    path: "{{item}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
    state: "directory"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
    owner: "{{bitcoind_user}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
    group: "{{bitcoind_user}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
    mode: "0770"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  with_items:
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
    - "{{bitcoind_data_dir}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
    - "{{bitcoind_log_dir}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
    - "{{bitcoind_conf_dir}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
- name: configure bitcoind
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  template:
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
    src: "bitcoin.conf.j2"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
    dest: "{{bitcoind_conf_dir}}/bitcoin.conf"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
    owner: "{{bitcoind_user}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    47
    group: "{{bitcoind_user}}"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    48
    mode: "0644"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    49
  notify: restart bitcoind
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    50
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    51
- name: install bitcoind service
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    52
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
  template:
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
    src: "bitcoind.service.j2"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
    dest: "/lib/systemd/system/bitcoind.service"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
    mode: "0644"
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
  notify: restart bitcoind
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    58
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    59
- name: ensure bitcoind is started
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    60
  become: yes
9934a00b9e97 Added bitcoind ansible
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    61
  systemd: service="bitcoind.service" enabled="yes" state="started" daemon_reload="yes"