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

51 lines
1.5 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 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: "{% if local_subnet.value %}{{ local_subnet.value }}{% else %}ctlplane-subnet{% endif %}"
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', true) }}"
when: >
"local_ip.value | default('0.0.0.0', true) | ipaddr('address')"
!=
"gateway.value | default('0.0.0.0', true) | ipaddr('address')"