Skip to content

Commit

Permalink
fix(deployment): wait for staking tokens before creating validator
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Sep 22, 2021
1 parent 83f45f6 commit 59952d3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/deployment/ansible/roles/cosmos-validators/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,22 @@
staker: "{{ STAKER }}-{{ inventory_hostname }}"
when: inventory_hostname != STAKER_NODE

- name: "Find staking_denom from {{ STAKER_SELF_DELEGATION }}"
set_fact:
staking_denom: "{{ STAKER_SELF_DELEGATION | regex_search('^[0-9]*(.*)', '\\1') | first }}"

- name: "Specially set JSON valconspub"
set_fact:
valconspub: "{{ lookup('file', data + '/' + inventory_hostname + '/pubkey') | string }}"

- name: "Wait for transfer of {{ staking_denom }} to arrive at {{ inventory_hostname }}"
shell: "\
ag-cosmos-helper query bank balances {{ staker_address.stdout }}"
register: staker_balance
until: staker_balance.stdout.find(staking_denom) != -1
delay: 10
retries: 60

- name: "Create validators for {{ STAKER }}-*"
become_user: "{{ service }}"
become: true
Expand Down

0 comments on commit 59952d3

Please sign in to comment.