tripleo-validations/roles/check_network_gateway/tasks/main.yml

44 lines
1.2 KiB
YAML

---
- name: Ensure we get needed facts
setup:
gather_subset:
- '!all'
- '!any'
- '!min'
- env
- name: Get the local_subnet name from the undercloud_conf file
become: true
validations_read_ini:
path: "{{ ansible_env.HOME }}/undercloud.conf"
section: DEFAULT
key: local_subnet
ignore_missing_file: true
register: local_subnet
- name: Get gateway value from the undercloud.conf file
become: true
validations_read_ini:
path: "{{ ansible_env.HOME }}/undercloud.conf"
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
validations_read_ini:
path: "{{ ansible_env.HOME }}/undercloud.conf"
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')"