Sync 'validations/check-network-gateway.yaml' with the new role

To be able to maintain stable branches, the validations in the 'validations'
directory have to be synchronized with the new role created with the
validation framework.

This patch synchronizes the check-network-gateway validation.

Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
(cherry picked from commit c025666cee8b94f14fd795d51c1113803fb42848)
(cherry picked from commit I7bb40a1f0b42cbbf5b38a3939db9140b602e5c52)

Change-Id: I7bb40a1f0b42cbbf5b38a3939db9140b602e5c52
This commit is contained in:
Gael Chamoulaud 2019-06-07 13:51:20 +02:00
parent c2b34e2c90
commit 49f8aad6c5
1 changed files with 16 additions and 5 deletions

View File

@ -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')"