forked from polkachu/secure-server-setup
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcosmos_horcrux_init.yml
69 lines (60 loc) · 1.94 KB
/
cosmos_horcrux_init.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
- name: Prep horcrux node(s) and install keys
hosts: localhost
gather_facts: false
any_errors_fatal: true
vars_files:
- "group_vars/mainnets/{{ target }}.yml"
- "group_vars/testnets/{{ target }}.yml"
tasks:
- name: Check variables
ansible.builtin.assert:
that:
- horcrux_group is defined
- sentries is defined
fail_msg: |
- horcrux_group: "horcrux_group not defined"
- sentries: "sentries not defined"
- name: Add all signers
ansible.builtin.add_host:
hostname: "{{ item }}"
group: horcrux_signers_for_play
loop: "{{ groups[horcrux_group] }}"
- name: Set shares when in degen mode
when: groups['horcrux_signers_for_play'] | length == 1
ansible.builtin.set_fact:
shares: 1
threshold: 1
- name: Set shares when in raft mode
when: groups['horcrux_signers_for_play'] | length > 1
ansible.builtin.set_fact:
shares: 3
threshold: 2
- name: Install Horcrux
hosts: horcrux_signers_for_play
gather_facts: true
any_errors_fatal: true
vars_files:
- "group_vars/mainnets/{{ target }}.yml"
- "group_vars/testnets/{{ target }}.yml"
pre_tasks:
- name: Set shares
ansible.builtin.set_fact:
shares: "{{ hostvars.localhost.shares }}"
threshold: "{{ hostvars.localhost.threshold }}"
- name: Check for key
become: true
delegate_to: localhost
ansible.builtin.stat:
path: "{{ playbook_dir }}/keys/priv_validator_key.json"
register: key_exists
- name: There is no key file present
when: not key_exists.stat.exists
ansible.builtin.pause:
prompt: There is no priv_validator key to process. Continue? Press return to continue. Press Ctrl+c and then "a" to abort
roles:
- util_go_install
- cosmos_horcrux_install
- cosmos_horcrux_configure
- cosmos_horcrux_create_shares
- cosmos_horcrux_restart