From 394aabc1d8aba1998f75cc2b969cb2d8522bbb95 Mon Sep 17 00:00:00 2001 From: Matt Burchett Date: Sun, 7 Jul 2024 22:56:12 +0000 Subject: [PATCH] preflight: check that the var is defined for the host before adding it to a map --- tasks/preflight.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tasks/preflight.yml b/tasks/preflight.yml index 8a26ff0..0606a16 100644 --- a/tasks/preflight.yml +++ b/tasks/preflight.yml @@ -3,7 +3,14 @@ block: - name: Collecting all nebula_internal_ip_addr values 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 set_fact: