bitcoind/tasks/main.yaml
changeset 4 9934a00b9e97
child 6 e0672e50e2c5
equal deleted inserted replaced
3:74f60cd1440b 4:9934a00b9e97
       
     1 ---
       
     2 
       
     3 - name: add bitcoind user
       
     4   become: yes
       
     5   user: name="{{bitcoind_user}}"
       
     6 
       
     7 - name: unarchive bitcoind
       
     8   become: yes
       
     9   unarchive:
       
    10     remote_src: yes
       
    11     src: "{{bitcoind_url}}"
       
    12     dest: "/tmp"
       
    13     creates: "/tmp/bitcoin-{{bitcoind_version}}/"
       
    14 
       
    15 - name: install bitcoind
       
    16   become: yes
       
    17   copy:
       
    18     src: "/tmp/bitcoin-{{bitcoind_version}}/bin/{{item}}"
       
    19     dest: "/usr/local/bin/"
       
    20     remote_src: yes
       
    21     owner: "root"
       
    22     group: "root"
       
    23     mode: "0755"
       
    24   with_items:
       
    25     - "bitcoind"
       
    26     - "bitcoin-cli"
       
    27 
       
    28 - name: create bitcoind data dir
       
    29   become: yes
       
    30   file:
       
    31     path: "{{item}}"
       
    32     state: "directory"
       
    33     owner: "{{bitcoind_user}}"
       
    34     group: "{{bitcoind_user}}"
       
    35     mode: "0770"
       
    36   with_items:
       
    37     - "{{bitcoind_data_dir}}"
       
    38     - "{{bitcoind_log_dir}}"
       
    39     - "{{bitcoind_conf_dir}}"
       
    40 
       
    41 - name: configure bitcoind
       
    42   become: yes
       
    43   template:
       
    44     src: "bitcoin.conf.j2"
       
    45     dest: "{{bitcoind_conf_dir}}/bitcoin.conf"
       
    46     owner: "{{bitcoind_user}}"
       
    47     group: "{{bitcoind_user}}"
       
    48     mode: "0644"
       
    49   notify: restart bitcoind
       
    50 
       
    51 - name: install bitcoind service
       
    52   become: yes
       
    53   template:
       
    54     src: "bitcoind.service.j2"
       
    55     dest: "/lib/systemd/system/bitcoind.service"
       
    56     mode: "0644"
       
    57   notify: restart bitcoind
       
    58 
       
    59 - name: ensure bitcoind is started
       
    60   become: yes
       
    61   systemd: service="bitcoind.service" enabled="yes" state="started" daemon_reload="yes"