Last active
December 20, 2019 09:54
-
-
Save goodc0re/ce2517f856d8bae641fd2e7de9dfa9ba to your computer and use it in GitHub Desktop.
Ansible playbook to update a zcoin masternode on Ubuntu, update Ubuntu with apt and reboot if needed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update_zcoin_mns.yml | |
--- | |
- hosts: zcoin_masternodes | |
vars_files: vault.yml | |
become: yes | |
become_method: sudo | |
tasks: | |
- name: Download zcoin binary | |
become: no | |
get_url: | |
url: https://github.com/zcoinofficial/zcoin/releases/download/v0.13.8.1/zcoin-0.13.8.1-linux64.tar.gz | |
dest: /home/znode | |
mode: 0440 | |
- name: Stop zcoind | |
become: no | |
command: ./zcoin-cli stop | |
args: | |
chdir: /home/znode/zcoin-0.13.8/bin | |
- name: Delete old binaries | |
become: yes | |
file: | |
path: /home/znode/zcoin-0.13.8 | |
state: absent | |
- name: Unarchive zcoin binary | |
become: no | |
unarchive: | |
src: /home/znode/zcoin-0.13.8.1-linux64.tar.gz | |
dest: /home/znode/ | |
remote_src: yes | |
- name: Delete downloaded archive | |
become: no | |
file: | |
path: /home/znode/zcoin-0.13.8.1-linux64.tar.gz | |
state: absent | |
- name: Delete znpayments.dat and zncache.dat and | |
become: no | |
file: | |
path: "{{ item }}" | |
state: absent | |
with_items: | |
- /home/znode/.zcoin/zncache.dat | |
- /home/znode/.zcoin/znpayments.dat | |
- name: Update all packages on a Debian/Ubuntu | |
apt: | |
update_cache: yes | |
upgrade: dist | |
- name: Check if a reboot is required | |
register: reboot_required_file | |
stat: path=/var/run/reboot-required get_md5=no | |
- name: Reboot box if kernel/libs updated and requested by the system | |
shell: sleep 10 && /sbin/shutdown -r now 'Rebooting box to update system libs/kernel as needed' | |
args: | |
removes: /var/run/reboot-required | |
async: 300 | |
poll: 0 | |
ignore_errors: true | |
when: reboot_required_file.stat.exists == true | |
- name: Wait for system to become reachable again | |
wait_for_connection: | |
delay: 60 | |
timeout: 300 | |
when: reboot_required_file.stat.exists == true | |
- name: Verify new update (optional) | |
command: uname -mrs | |
register: uname_result | |
when: reboot_required_file.stat.exists == true | |
- name: Display new kernel version | |
debug: | |
var: uname_result.stdout_lines | |
when: reboot_required_file.stat.exists == true | |
- name: Restart znode | |
become: no | |
command: ./zcoind -daemon | |
args: | |
chdir: /home/znode/zcoin-0.13.8/bin |
Lines 46 & 47 should read as
- /home/znode/.zcoin/zncache.dat
- /home/znode/.zcoin/znpayments.dat
Unless you really have the .zcoin
folder in /home
Lines 46 & 47 should read as
- /home/znode/.zcoin/zncache.dat
- /home/znode/.zcoin/znpayments.dat
Unless you really have the.zcoin
folder in/home
Thanks, you're right! Fixed it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This playbook requires:
Command I use to run this playbook with ansible:
$ ansible-playbook -i hosts --ask-vault-pass update_zcoin_mns.yml
Attention:
Version numbers are hardcoded and need to be checked and updated manually before running this playbook!