From 59952d3afd78ceb9b00eac5a8ccc84bef9d2ee4b Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Tue, 21 Sep 2021 20:54:05 -0600 Subject: [PATCH] fix(deployment): wait for staking tokens before creating validator --- .../ansible/roles/cosmos-validators/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/deployment/ansible/roles/cosmos-validators/tasks/main.yml b/packages/deployment/ansible/roles/cosmos-validators/tasks/main.yml index 3e0447b73e2..ff26f61be0a 100644 --- a/packages/deployment/ansible/roles/cosmos-validators/tasks/main.yml +++ b/packages/deployment/ansible/roles/cosmos-validators/tasks/main.yml @@ -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