diff --git a/group_vars/all.example b/group_vars/all.example index 4208a08..5842d72 100644 --- a/group_vars/all.example +++ b/group_vars/all.example @@ -6,3 +6,7 @@ access_key: "KEY_NAME" secret_key: "KEY_SECRET" s3_bucket: "BUCKET_NAME" + +#For HFs +MAIN_REPO_FETCH: "poanetwork" +GENESIS_BRANCH: "sokol" diff --git a/hosts.example b/hosts.example index 487d9dc..ed04adf 100644 --- a/hosts.example +++ b/hosts.example @@ -1,2 +1,5 @@ [backup] INSERT_HERE_SERVERS_HOSTNAME_OR_IPs + +[hf-spec-change] +INSERT_HERE_SERVERS_HOSTNAME_OR_IPs diff --git a/roles/hf-spec-change/tasks/main.yml b/roles/hf-spec-change/tasks/main.yml new file mode 100644 index 0000000..2d04449 --- /dev/null +++ b/roles/hf-spec-change/tasks/main.yml @@ -0,0 +1,23 @@ +--- +- name: Shutdown poa-netstats service + service: name=poa-netstats state=stopped + +- name: Shutdown poa-parity service + service: name=poa-parity state=stopped + +- name: Create directory for spec backups + file: path={{ home }}/spec-hfs state=directory + +- name: Create previous spec backup + command: cp {{ home }}/spec.json {{ home }}/spec-hfs/spec-hf-{{ date }}.json + +- name: Download new spec + get_url: url={{ item }} dest={{ home }}/ mode=0644 + with_items: + - "https://raw.githubusercontent.com/{{ MAIN_REPO_FETCH }}/poa-chain-spec/{{ GENESIS_BRANCH }}/spec.json" + +- name: Launch poa-parity service + service: name=poa-parity state=started + +- name: Launch poa-netstats service + service: name=poa-netstats state=started diff --git a/site.yml b/site.yml index 17ee158..6d481c0 100644 --- a/site.yml +++ b/site.yml @@ -5,3 +5,12 @@ roles: - backup-parity tags: backup + +- hosts: hf-spec-change + vars: + date: "{{ lookup('pipe', 'date -u +%Y%m%d-%H%M%S') }}" + home: "/home/{{ poa_role }}" + user: root + roles: + - hf-spec-change + tags: hf-spec