src.nth.io/

summaryrefslogtreecommitdiff
path: root/bitcoind/tasks/main.yaml
blob: 53e2e0ae9b06bbd8186470390edacdf09c7d6086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---

- name: add bitcoind user
  become: yes
  user: name="{{bitcoind_user}}"

- name: unarchive bitcoind
  become: yes
  unarchive:
    remote_src: yes
    src: "{{bitcoind_url}}"
    dest: "/tmp"
    creates: "/tmp/bitcoin-{{bitcoind_version}}/"

- name: install bitcoind
  become: yes
  copy:
    src: "/tmp/bitcoin-{{bitcoind_version}}/bin/{{item}}"
    dest: "/usr/local/bin/"
    remote_src: yes
    owner: "root"
    group: "root"
    mode: "0755"
  with_items:
    - "bitcoind"
    - "bitcoin-cli"

- name: create bitcoind data dir
  become: yes
  file:
    path: "{{item}}"
    state: "directory"
    owner: "{{bitcoind_user}}"
    group: "{{bitcoind_user}}"
    mode: "0770"
  with_items:
    - "{{bitcoind_data_dir}}"
    - "{{bitcoind_log_dir}}"
    - "{{bitcoind_conf_dir}}"

- name: configure bitcoind
  become: yes
  template:
    src: "bitcoin.conf.j2"
    dest: "{{bitcoind_conf_dir}}/bitcoin.conf"
    owner: "{{bitcoind_user}}"
    group: "{{bitcoind_user}}"
    mode: "0644"
  notify: restart bitcoind

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

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