126 lines
4.2 KiB
YAML
126 lines
4.2 KiB
YAML
---
|
|
- set_fact:
|
|
PARITY_BIN_LOC: "https://releases.parity.io/ethereum/v2.6.8/x86_64-unknown-linux-gnu/parity"
|
|
PARITY_BIN_SHA256: "299f928503cb3b8d44d95a0f592e32358542ec854842c277e3eeaee2a3478a28"
|
|
PARITY_VERSION_CHECK: "2.6.8"
|
|
when: GENESIS_BRANCH == 'sokol'
|
|
|
|
- set_fact:
|
|
PARITY_BIN_LOC: "https://releases.parity.io/ethereum/v2.6.8/x86_64-unknown-linux-gnu/parity"
|
|
PARITY_BIN_SHA256: "299f928503cb3b8d44d95a0f592e32358542ec854842c277e3eeaee2a3478a28"
|
|
PARITY_VERSION_CHECK: "2.6.8"
|
|
when: GENESIS_BRANCH == 'kovan'
|
|
|
|
- set_fact:
|
|
PARITY_BIN_LOC: "https://releases.parity.io/ethereum/v2.6.8/x86_64-unknown-linux-gnu/parity"
|
|
PARITY_BIN_SHA256: "299f928503cb3b8d44d95a0f592e32358542ec854842c277e3eeaee2a3478a28"
|
|
PARITY_VERSION_CHECK: "2.6.8"
|
|
when: GENESIS_BRANCH == 'dai'
|
|
|
|
- set_fact:
|
|
PARITY_BIN_LOC: "https://releases.parity.io/ethereum/v2.6.8/x86_64-unknown-linux-gnu/parity"
|
|
PARITY_BIN_SHA256: "299f928503cb3b8d44d95a0f592e32358542ec854842c277e3eeaee2a3478a28"
|
|
PARITY_VERSION_CHECK: "2.6.8"
|
|
when: GENESIS_BRANCH == 'core'
|
|
|
|
- set_fact:
|
|
PARITY_BIN_LOC_UBUNTU: "{{ PARITY_BIN_LOC }}"
|
|
PARITY_BIN_SHA256_UBUNTU: "{{ PARITY_BIN_SHA256 }}"
|
|
PARITY_BIN_LOC_CENTOS: "{{ PARITY_BIN_LOC }}"
|
|
PARITY_BIN_SHA256_CENTOS: "{{ PARITY_BIN_SHA256 }}"
|
|
|
|
- name: Check that node role is correct
|
|
stat:
|
|
path: "{{ home }}"
|
|
register: role_home_folder
|
|
failed_when: not role_home_folder.stat.exists
|
|
|
|
- name: Check that the netstats service is installed
|
|
stat:
|
|
path: /etc/systemd/system/poa-netstats.service
|
|
register: netstats_service_file
|
|
|
|
### checks for PARITY_VERSION_CHECK
|
|
- name: Check if previous backups are present
|
|
stat: path="{{ home }}/backups-version/BEFORE-{{ PARITY_VERSION_CHECK }}"
|
|
register: bkp_version
|
|
|
|
- name: Remove previous version backups
|
|
file: path="{{ home }}/backups-version" state=absent
|
|
when: bkp_version.stat.exists == False
|
|
|
|
- name: Create directory for parity-version backups
|
|
file: path="{{ backups_folder }}" state=directory
|
|
|
|
- name: Create backups version file
|
|
file: path="{{ home }}/backups-version/BEFORE-{{ PARITY_VERSION_CHECK }}" state=touch
|
|
|
|
### actual upgrade
|
|
- name: Shutdown poa-netstats service
|
|
service: name=poa-netstats state=stopped
|
|
when: netstats_service_file.stat.exists
|
|
|
|
- name: Shutdown poa-parity service
|
|
service: name=poa-parity state=stopped
|
|
|
|
- name: Backup parity binary
|
|
command: cp -a {{ home }}/parity {{ backups_folder }}/parity
|
|
|
|
- name: Backup parity_data
|
|
command: cp -a "{{ home }}/parity_data" {{ backups_folder }}/parity_data
|
|
when: (backup_parity_data or "off") == "on"
|
|
|
|
- name: Backup node.toml
|
|
command: cp -a "{{ home }}/node.toml" {{ backups_folder }}/node.toml
|
|
|
|
- name: Download new parity binary version (Debian-like)
|
|
get_url: url="{{ PARITY_BIN_LOC_UBUNTU }}" dest="{{ home }}/parity" mode=0755 checksum="sha256:{{ PARITY_BIN_SHA256_UBUNTU }}"
|
|
when: ansible_os_family == "Debian"
|
|
|
|
- name: Download new parity binary version (RedHat-like)
|
|
get_url: url="{{ PARITY_BIN_LOC_CENTOS }}" dest="{{ home }}/parity" mode=0755 checksum="sha256:{{ PARITY_BIN_SHA256_CENTOS }}"
|
|
when: ansible_os_family == "RedHat"
|
|
|
|
- name: Remove lines from node.toml (bootnode only)
|
|
ini_file:
|
|
path: "{{ home }}/node.toml"
|
|
section: "{{ item['section'] }}"
|
|
option: "{{ item['option'] }}"
|
|
state: absent
|
|
with_items: "{{ bootnode_node_toml_lines_to_remove }}"
|
|
when: poa_role == "bootnode"
|
|
|
|
- name: Add lines to node.toml (bootnode only)
|
|
ini_file:
|
|
path: "{{ home }}/node.toml"
|
|
value: "{{ item['value'] }}"
|
|
section: "{{ item['section'] }}"
|
|
option: "{{ item['option'] }}"
|
|
state: present
|
|
with_items: "{{ bootnode_node_toml_lines_to_add }}"
|
|
when: poa_role == "bootnode"
|
|
|
|
- name: Remove old database
|
|
command: "./parity --config node.toml db kill"
|
|
args:
|
|
chdir: "{{ home }}"
|
|
become: true
|
|
become_user: "{{ poa_role }}"
|
|
when: (resync or "off") == "on"
|
|
|
|
- name: Update netstats
|
|
command: "git pull origin master"
|
|
args:
|
|
chdir: "{{ home }}/eth-net-intelligence-api"
|
|
when: (update_netstats or "off") == "on"
|
|
become: true
|
|
become_user: "{{ poa_role }}"
|
|
ignore_errors: yes
|
|
|
|
- name: Launch poa-parity service
|
|
service: name=poa-parity state=started
|
|
|
|
- name: Launch poa-netstats service
|
|
service: name=poa-netstats state=started
|
|
when: netstats_service_file.stat.exists
|