diff --git a/validations/check-network-gateway.yaml b/validations/check-network-gateway.yaml index f7271ad7d..8da4e048b 100644 --- a/validations/check-network-gateway.yaml +++ b/validations/check-network-gateway.yaml @@ -11,13 +11,23 @@ tasks: - name: Get the path of tripleo undercloud config file become: true - hiera: name="tripleo_undercloud_conf_file" + hiera: + name: "tripleo_undercloud_conf_file" + + - name: Get the local_subnet name from the undercloud_conf file + become: True + ini: + path: "{{ tripleo_undercloud_conf_file }}" + section: DEFAULT + key: local_subnet + ignore_missing_file: True + register: local_subnet - name: Get gateway value from the undercloud.conf file become: true ini: path: "{{ tripleo_undercloud_conf_file }}" - section: ctlplane-subnet + section: "{% if local_subnet.value %}{{ local_subnet.value }}{% else %}ctlplane-subnet{% endif %}" key: gateway ignore_missing_file: True register: gateway @@ -32,8 +42,9 @@ register: local_ip - name: Test network_gateway if different from local_ip - icmp_ping: host="{{ gateway.value | default('0.0.0.0') }}" + icmp_ping: + host: "{{ gateway.value | default('0.0.0.0', true) }}" when: > - "local_ip.value | default('0.0.0.0') | ipaddr('address')" + "local_ip.value | default('0.0.0.0', true) | ipaddr('address')" != - "gateway.value | default('0.0.0.0') | ipaddr('address')" + "gateway.value | default('0.0.0.0', true) | ipaddr('address')"