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

26 lines
1.0 KiB
YAML

---
- 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!'
- name: Check compare existing validators
set_fact:
secrets_diff: '{{ new_secrets|difference(old_secrets) }}'
validators_diff: '{{ new_validators|difference(old_validators) }}'
- name: Check if validators changed
set_fact:
secrets_changed: '{{ secrets_diff|length > 0 }}'
validators_changed: '{{ validators_diff|length > 0 }}'