From b7c8c30bb3c8d492354f809a088316d0c257c8c6 Mon Sep 17 00:00:00 2001 From: Erik Berg <openstack@slipsprogrammor.no> Date: Mon, 16 Jan 2023 15:11:53 +0100 Subject: [PATCH] vips: assert shows what we're testing and when assert will also fail when we're not meeting the conditions, makes clear what we're actually testing, and isn't listed as a skipped task when the condition is ok. Change-Id: I640207dd9e987cb6d5743e22cae6039a65d10566 --- ansible/kolla-ansible.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ansible/kolla-ansible.yml b/ansible/kolla-ansible.yml index a469e474d..1a7469424 100644 --- a/ansible/kolla-ansible.yml +++ b/ansible/kolla-ansible.yml @@ -56,15 +56,17 @@ # Configuration and validation of network host networking. - name: Validate Kolla Ansible API address configuration - fail: - msg: > + assert: + that: + - hostvars[inventory_hostname][item.var_name] is defined + - hostvars[inventory_hostname][item.var_name] | length > 0 + fail_msg: > The Kolla Ansible variable {{ item.var_name }} ({{ item.description }}) is invalid. Value: "{{ hostvars[inventory_hostname][item.var_name] | default('<undefined>') }}". when: - groups['network'] | length > 0 - item.required | bool - - hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name] with_items: - var_name: "kolla_internal_vip_address" description: "Internal API VIP address"