tripleo-validations/validations/check-network-gateway.yaml

40 lines
1.1 KiB
YAML

---
- hosts: undercloud
vars:
metadata:
name: Check network_gateway on the provisioning network
description: >
If `gateway` in `undercloud.conf` is different from `local_ip`,
verify that the gateway exists and is reachable.
groups:
- pre-introspection
tasks:
- name: Get the path of tripleo undercloud config file
become: true
hiera: name="tripleo_undercloud_conf_file"
- name: Get gateway value from the undercloud.conf file
become: true
ini:
path: "{{ tripleo_undercloud_conf_file }}"
section: ctlplane-subnet
key: gateway
ignore_missing_file: True
register: gateway
- name: Get local_ip value from the undercloud.conf file
become: true
ini:
path: "{{ tripleo_undercloud_conf_file }}"
section: DEFAULT
key: local_ip
ignore_missing_file: True
register: local_ip
- name: Test network_gateway if different from local_ip
icmp_ping: host="{{ gateway.value | default('0.0.0.0') }}"
when: >
"local_ip.value | default('0.0.0.0') | ipaddr('address')"
!=
"gateway.value | default('0.0.0.0') | ipaddr('address')"