Add check-network-gateway role

This patch adds this new role created from:
- validations/check-network-gateway.yaml

Change-Id: I92447680f04e6ea4d98e3b1345c844b453d1b9d7
Implements: blueprint validation-framework
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2019-02-18 12:39:26 +00:00
parent 6ecfb48553
commit 3142069647
4 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,12 @@
---
- 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
roles:
- check-network-gateway

View File

@ -0,0 +1,27 @@
galaxy_info:
author: TripleO Validations Team
company: Red Hat
license: Apache
min_ansible_version: 2.4
platforms:
- name: CentOS
versions:
- 7
- name: RHEL
versions:
- 7
categories:
- cloud
- baremetal
- system
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []

View File

@ -0,0 +1,40 @@
---
- 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') }}"
when: >
"local_ip.value | default('0.0.0.0') | ipaddr('address')"
!=
"gateway.value | default('0.0.0.0') | ipaddr('address')"

View File

@ -0,0 +1,8 @@
---
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