Add role upd-scripts-validator

This commit is contained in:
phahulin 2018-02-02 19:19:40 +03:00
parent 8796734cea
commit b9e00ca05e
4 changed files with 50 additions and 2 deletions

View File

@ -1,7 +1,6 @@
---
poa_role: "bootnode|validator|moc|explorer|netstat"
#For Backups
access_key: "KEY_NAME"
secret_key: "KEY_SECRET"
s3_bucket: "BUCKET_NAME"
@ -9,6 +8,7 @@ node_name: "NODE_NAME"
backup_parity_data: true
backup_parity_blocks: true
#For HFs
MAIN_REPO_FETCH: "poanetwork"
GENESIS_BRANCH: "sokol"
SCRIPTS_VALIDATOR_BRANCH: "sokol"

View File

@ -0,0 +1,4 @@
---
# repo to fetch scripts from
MAIN_REPO_FETCH: "poanetwork"
SCRIPTS_VALIDATOR_BRANCH: "sokol"

View File

@ -0,0 +1,31 @@
---
- name: Check that node role is correct
stat:
path: "{{ home }}"
register: role_home_folder
failed_when: not role_home_folder.stat.exists
- name: Create directory for backups
file: path={{ home }}/backups-scripts-validator state=directory
- name: Backup existing version
command: cp -a {{ home }}/poa-scripts-validator {{ home }}/backups-scripts-validator/poa-scripts-validator-{{ date }}
- name: Delete existing version
file:
state: absent
path: "{{ home }}/poa-scripts-validator"
- name: Download new version
git: repo=https://github.com/{{ MAIN_REPO_FETCH }}/poa-scripts-validator dest={{ home }}/poa-scripts-validator version={{ SCRIPTS_VALIDATOR_BRANCH }}
- name: Symlink node.toml
file: src="{{ home }}/node.toml" dest="{{ home }}/poa-scripts-validator/node.toml" owner="{{ username }}" group="{{ username }}" state=link
- name: Change owner
file: path={{ home }}/poa-scripts-validator owner={{ username }} group={{ username }} recurse=yes
- name: Run npm install from transferRewardToPayoutKey
shell: "cd {{ home }}/poa-scripts-validator/transferRewardToPayoutKey; /usr/bin/npm install"
become: true
become_user: "{{ username }}"

View File

@ -16,3 +16,16 @@
roles:
- hf-spec-change
tags: hf-spec
- hosts: upd-scripts-validator
vars:
poa_role: validator
username: validator
date: "{{ lookup('pipe', 'date -u +%Y%m%d-%H%M%S') }}"
home: "/home/{{ poa_role }}"
user: root
become: true
become_user: root
roles:
- upd-scripts-validator
tags: upd-validator