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
50 lines
1.7 KiB
YAML
50 lines
1.7 KiB
YAML
---
|
|
# Copyright 2021 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: Set IP options
|
|
set_fact:
|
|
_sed_opts: "'s/.*dev \\([^ ]*\\).*/\\1/') "
|
|
_ping_cmd: "{{ (':' in controller) | ternary('ping6', 'ping') }}"
|
|
- name: Lookup interface information
|
|
register: _nic_mtu
|
|
shell: |
|
|
INT=$(ip ro get {{ controller }} | head -1 | sed '{{ _sed_opts }}')
|
|
MTU=$(cat /sys/class/net/${INT}/mtu 2>/dev/null || echo "0")
|
|
echo "$INT $MTU"
|
|
- name: Set interface vars
|
|
set_fact:
|
|
_nic: "{{ _nic_mtu.get('stdout', '').split(' ')[0] | default('lo') }}"
|
|
_mtu: "{{ _nic_mtu.get('stdout', '').split(' ')[1] | default(0) | int - 28 }}"
|
|
- name: Network availability validation block
|
|
block:
|
|
- name: Check IP responsiveness
|
|
command: "{{ _ping_cmd }} -w 10 -c 5 {{ controller }}"
|
|
retries: 10
|
|
delay: 60
|
|
changed_when: false
|
|
register: ping_result
|
|
until: ping_result.rc == 0
|
|
|
|
- name: Validate packet with {{ _mtu }} MTU size can reach controller from {{ _nic }}
|
|
command: "{{ _ping_cmd }} -w 10 -s {{ _mtu }} -c 5 {{ controller }}"
|
|
retries: 10
|
|
delay: 60
|
|
changed_when: false
|
|
register: mtu_ping
|
|
until: mtu_ping.rc == 0
|
|
when: _mtu | int > 0
|
|
when: _nic != 'lo'
|