forked from CiscoDevNet/ps-crn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
waitfor-sync.yml
22 lines (21 loc) · 905 Bytes
/
waitfor-sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
- name: Wait for vEdge Sync
hosts: vmanage1
connection: local
roles:
- ansible-viptela
gather_facts: no
tasks:
- name: Get device facts
vmanage_device_facts:
user: "{{ ansible_user }}"
host: "{{ ansible_host }}"
password: "{{ ansible_password }}"
register: device_facts
delegate_to: localhost
until: (all_vedges | difference(device_facts.vedges | selectattr('configStatusMessage', 'defined') | selectattr('configStatusMessage', 'equalto', 'In Sync') | map(attribute='host-name') | list) | length) == 0
retries: 60
delay: 10
vars:
all_vedges: "{{ groups.viptela_vedge | intersect(groups.virl_hosts) }}"
- debug:
msg: "vEdge in sync: {{ device_facts.vedges | selectattr('configStatusMessage', 'defined') | selectattr('configStatusMessage', 'equalto', 'In Sync') | map(attribute='host-name') | list }}"