preflight: check that the var is defined for the host before adding it to a map

This commit is contained in:
Matt Burchett
2024-07-07 22:56:12 +00:00
committed by Andrew Paglusch
parent c73ebba5b6
commit 394aabc1d8

View File

@@ -3,7 +3,14 @@
block: block:
- name: Collecting all nebula_internal_ip_addr values - name: Collecting all nebula_internal_ip_addr values
set_fact: set_fact:
sorted_ips: "{{ hostvars | map('extract', hostvars, ['nebula_internal_ip_addr']) | list | sort }}" sorted_ips: >-
{{ hostvars
| dict2items
| selectattr('value.nebula_internal_ip_addr', 'defined')
| map(attribute='value.nebula_internal_ip_addr')
| list
| sort
}}
- name: Initialize duplicated_ips list - name: Initialize duplicated_ips list
set_fact: set_fact: