You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

120 lines
2.9 KiB

---
- hosts: bitcoind
gather_facts: no
roles:
- ubuntu-16-04
vars:
- x_user: bitcoin
- x_group: bitcoin
- x_home: /home/bitcoin
- x_config_dir: /home/bitcoin/.bitcoin
- x_download_url: https://bitcoin.org/bin/bitcoin-core-0.17.1/bitcoin-0.17.1-x86_64-linux-gnu.tar.gz
- x_download_dest: /home/ubuntu/bitcoin.tar.gz
- x_download_checksum: sha1:546ee35d4089c7ccc040a01cdff3362599b8bc53
- x_unarchive_dest: /home/bitcoin/app
tasks:
- name: Create the bitcoin group
become: yes
group:
name={{ x_group }}
state=present
- name: Create the bitcoin user
become: yes
user:
name={{ x_user }}
group={{ x_group }}
state=present
system=yes
- name: Create the app directory
become: yes
file:
path={{ x_home }}/app
state=directory
owner={{ x_user }}
group={{ x_group }}
- name: Create the config directory
become: yes
file:
path={{ x_config_dir }}
state=directory
owner={{ x_user }}
group={{ x_group }}
- name: Download the bitcoind
get_url:
url={{ x_download_url }}
dest={{ x_download_dest }}
checksum={{ x_download_checksum }}
- name: Unpack the application
become: yes
unarchive:
remote_src=yes
src={{ x_download_dest }}
dest={{ x_unarchive_dest }}
owner={{ x_user }}
group={{ x_group }}
- name: Move the application to the right folder
become: yes
command: mv {{ x_unarchive_dest }}/bitcoin-0.17.1/bin/bitcoind {{ x_unarchive_dest }}
- name: Set the application as executable
become: yes
file:
path: "{{ x_unarchive_dest }}/bitcoind"
mode: "u=rwx"
- name: Set the application config
become: yes
copy:
src=config/bitcoin.conf
dest={{ x_config_dir }}/bitcoin.conf
owner={{ x_user }}
group={{ x_group }}
- name: Set the application files permissions
become: yes
file:
dest={{ x_config_dir }}
owner={{ x_user }}
group={{ x_group }}
recurse=yes
- name: Set the application files permissions
become: yes
file:
dest={{ x_unarchive_dest }}
owner={{ x_user }}
group={{ x_group }}
recurse=yes
- name: Add the systemd service
become: yes
copy:
src: systemd-services/bitcoin-rpc.service
dest: /etc/systemd/system/
owner: root
group: root
- name: Pick up systemd changes
become: yes
systemd:
daemon_reload: yes
- name: Restart the application
become: yes
systemd:
name: bitcoin-rpc
state: restarted
- name: Enable the application to run on system startup
become: yes
systemd:
name: bitcoin-rpc
enabled: yes