infra-nimbus/ansible/roles/distribute-validators/tasks/check.yml

32 lines
1.1 KiB
YAML
Raw Normal View History

---
- name: Verify number of validators and secrets matches
assert:
that: '{{ (found_validators|length) == (found_secrets|length) }}'
fail_msg: 'Number of total validators and secrets does not match!'
- name: Extract slice for host
set_fact:
new_validators: '{{ found_validators[dist_validators_range["start"]:dist_validators_range["end"]] }}'
new_secrets: '{{ found_secrets[dist_validators_range["start"]:dist_validators_range["end"]] }}'
- name: Verify that validators and secrets overlap
assert:
that: '{{ (new_validators|intersect(new_secrets)|length) == (new_validators|length) }}'
fail_msg: 'List of validators and their secrets does not overlap!'
- debug: var=new_validators[0:10]
- debug: var=old_validators[0:10]
- name: Check compare existing validators
set_fact:
secrets_diff: '{{ new_secrets|difference(old_secrets) }}'
validators_diff: '{{ new_validators|difference(old_validators) }}'
- debug: var=secrets_diff[0:10]
- debug: var=validators_diff[0:10]
- name: Check if validators changed
set_fact:
secrets_changed: '{{ secrets_diff|length > 0 }}'
validators_changed: '{{ validators_diff|length > 0 }}'