From 2b3a97bddd835a2a966da018a9208da19fa77757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Thu, 29 Aug 2024 14:29:15 +0200 Subject: [PATCH] OCPBUGS-39285: Fix var_files syntax to work on older version of ansible On ansible-core 2.14 and below, `var_files` chokes on missing file. This is no longer the case with ansible-core 2.15. We need a different strategy so that ansible ignores non-existent files. --- upi/openstack/common.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/upi/openstack/common.yaml b/upi/openstack/common.yaml index 4f68cfacfa..47bd82e01b 100644 --- a/upi/openstack/common.yaml +++ b/upi/openstack/common.yaml @@ -1,11 +1,17 @@ - hosts: localhost gather_facts: no - vars_files: - - metadata.json - - netid.json + vars: + var_files: + - metadata.json + - netid.json tasks: + - name: "Include external vars" + include_vars: "{{ item }}" + when: item is exists + loop: "{{ var_files|flatten(levels=1) }}" + - name: "Check if metadata.json exists" ansible.builtin.stat: path: metadata.json