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.

107 lines
2.6 KiB

---
- hosts: ltcd
gather_facts: no
roles:
- ubuntu-16-04
vars:
- ltc_user: ltc
- ltc_group: ltc
- ltc_home: /home/ltc
- ltc_config_dir: /home/ltc/.litecoin
- ltc_download_url: https://download.litecoin.org/litecoin-0.16.3/linux/litecoin-0.16.3-x86_64-linux-gnu.tar.gz
- ltc_download_dest: /home/ubuntu/ltc.tar.gz
- ltc_download_checksum: sha1:963e958bf5dd045fd70d787d6830f64962ae977d
- ltc_unarchive_dest: /home/ltc/app
tasks:
- name: Create the ltc group
become: yes
group:
name={{ ltc_group }}
state=present
- name: Create the ltc user
become: yes
user:
name={{ ltc_user }}
group={{ ltc_group }}
state=present
system=yes
- name: Create the app directory
become: yes
file:
path={{ ltc_home }}/app
state=directory
owner={{ ltc_user }}
group={{ ltc_group }}
- name: Create the config directory
become: yes
file:
path={{ ltc_config_dir }}
state=directory
owner={{ ltc_user }}
group={{ ltc_group }}
- name: Download the ltcd
get_url:
url={{ ltc_download_url }}
dest={{ ltc_download_dest }}
checksum={{ ltc_download_checksum }}
- name: Unpack the application
become: yes
unarchive:
remote_src=yes
src={{ ltc_download_dest }}
dest={{ ltc_unarchive_dest }}
owner={{ ltc_user }}
group={{ ltc_group }}
- name: Move the application to the right folder
become: yes
command: mv {{ ltc_unarchive_dest }}/litecoin-0.16.3/bin/litecoind {{ ltc_unarchive_dest }}
- name: Set the application config
become: yes
copy:
src=config/litecoin.conf
dest={{ ltc_config_dir }}/litecoin.conf
owner={{ ltc_user }}
group={{ ltc_group }}
- name: Set the application files permissions
become: yes
file:
dest={{ ltc_home }}
owner={{ ltc_user }}
group={{ ltc_group }}
recurse=yes
- name: Add the systemd service
become: yes
copy:
src: systemd-services/ltc-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: ltc-rpc
state: restarted
- name: Enable the application to run on system startup
become: yes
systemd:
name: ltc-rpc
enabled: yes