5d40212582
Currently, the ICMP check can fail if the network configuration takes too long. This can fail the overall deployment, but the network configuration can still be successful. This change broadens the scope of the connectivity check by increasing the number of ICMP requests sent each time. To make it more flexibile and allowing for situations where interfaces take a little longer to become active. Change-Id: I89a3b9a562fb060293deb08dbc7e97aacfcc5b73
81 lines
2.5 KiB
YAML
81 lines
2.5 KiB
YAML
---
|
|
# Copyright 2020 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
- name: Collect default network fact
|
|
setup:
|
|
gather_subset:
|
|
- '!all'
|
|
- '!min'
|
|
- network
|
|
filter: 'ansible_default_ipv4'
|
|
|
|
- name: Check Default IPv4 Gateway availability
|
|
command: "ping -w 10 -c 5 {{ ansible_facts.default_ipv4.gateway }}"
|
|
retries: 10
|
|
delay: 60
|
|
changed_when: false
|
|
check_mode: false
|
|
register: ping_result
|
|
until: ping_result.rc == 0
|
|
when:
|
|
- tripleo_nodes_validation_validate_gateway_icmp|bool
|
|
- ansible_facts.default_ipv4 is defined
|
|
- ansible_facts.default_ipv4.gateway is defined
|
|
|
|
# Ping test the gateway IPs before nodes, see RHBZ#1875962
|
|
- name: Check all networks Gateway availability
|
|
command: "{{ (':' in gateway_ip) | ternary('ping6', 'ping') }} -w 10 -c 5 {{ gateway_ip }}"
|
|
retries: 10
|
|
delay: 60
|
|
loop_control:
|
|
loop_var: gateway_ip
|
|
loop: "{{ tripleo_nodes_validation_ping_test_gateway_ips }}"
|
|
changed_when: false
|
|
check_mode: false
|
|
register: ping_gw_result
|
|
until: ping_gw_result.rc == 0
|
|
when:
|
|
- tripleo_nodes_validation_validate_gateway_icmp|bool
|
|
- tripleo_nodes_validation_ping_test_gateway_ips | length > 0
|
|
|
|
- name: Check Controllers availability
|
|
include_tasks:
|
|
file: ping.yml
|
|
apply:
|
|
check_mode: false
|
|
loop_control:
|
|
loop_var: controller
|
|
loop: "{{ tripleo_nodes_validation_ping_test_ips }}"
|
|
when:
|
|
- tripleo_nodes_validation_validate_controllers_icmp|bool
|
|
- tripleo_nodes_validation_ping_test_ips | length > 0
|
|
|
|
- name: Verify the configured FQDN vs /etc/hosts
|
|
shell: |
|
|
HOSTNAME=$(hostname)
|
|
SHORT_NAME=$(hostname -s)
|
|
FQDN_FROM_HOSTS=$(awk '$3 == "'${SHORT_NAME}'"{print $2}' /etc/hosts)
|
|
if [[ $HOSTNAME != $FQDN_FROM_HOSTS ]]; then
|
|
echo "FAILURE"
|
|
echo -e "System hostname: ${HOSTNAME}\nEntry from /etc/hosts: ${FQDN_FROM_HOSTS}\n"
|
|
exit 1
|
|
fi
|
|
exit 0
|
|
changed_when: false
|
|
check_mode: false
|
|
when:
|
|
- tripleo_nodes_validation_validate_fqdn|bool
|