From 111f2156489f224621059225d86709256079f1a9 Mon Sep 17 00:00:00 2001 From: Guillermo Ojea Quintana Date: Fri, 10 Nov 2023 13:27:47 -0300 Subject: [PATCH 1/2] Use NetCat instead of ping to test NTP, since some firewalls might block ICMP --- roles/validate_inventory/tasks/network.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/validate_inventory/tasks/network.yml b/roles/validate_inventory/tasks/network.yml index 6bace421..b8e507c8 100644 --- a/roles/validate_inventory/tasks/network.yml +++ b/roles/validate_inventory/tasks/network.yml @@ -16,6 +16,6 @@ - name: Ensure NTP server is available if not being set up shell: # noqa 305 - cmd: "ping -c 1 -W 2 {{ ntp_server }}" + cmd: "nc -vz -u {{ ntp_server }}" changed_when: False when: (setup_ntp_service | default(True)) != True From 267e7c420631444368a66f6c707fa0adf7844b42 Mon Sep 17 00:00:00 2001 From: Guillermo Ojea Quintana Date: Fri, 10 Nov 2023 15:03:06 -0300 Subject: [PATCH 2/2] Use NetCat instead of ping to test BMC connection, also don't require it for PXE --- roles/validate_inventory/tasks/cluster.yml | 1 + roles/validate_inventory/tasks/network.yml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/validate_inventory/tasks/cluster.yml b/roles/validate_inventory/tasks/cluster.yml index 643df460..5dc777e9 100644 --- a/roles/validate_inventory/tasks/cluster.yml +++ b/roles/validate_inventory/tasks/cluster.yml @@ -45,6 +45,7 @@ quiet: true fail_msg: "Node {{ item }} must have either bmc_ip" loop: "{{ groups['nodes'] }}" + when: hostvars[item]['vendor'] | lower != 'pxe' - name: Assert bmc_ip is correct type assert: diff --git a/roles/validate_inventory/tasks/network.yml b/roles/validate_inventory/tasks/network.yml index b8e507c8..87ea653b 100644 --- a/roles/validate_inventory/tasks/network.yml +++ b/roles/validate_inventory/tasks/network.yml @@ -1,11 +1,12 @@ --- # Node `ansible_host`s are not pinged. They are not required to be running at this stage. # KVM node BMCs are not checked, the vm_host will be pinged later. +# PXE node BMCs are not checked because it is not required - name: Ensure baremetal node BMCs are reachable shell: # noqa 305 - cmd: "ping -c 1 -W 2 {{ hostvars[item]['bmc_ip'] | default(hostvars[item]['bmc_address']) }}" + cmd: "nc -vz -u {{ hostvars[item]['bmc_ip'] | default(hostvars[item]['bmc_address']) }}" changed_when: False - when: hostvars[item]['vendor'] | lower != 'kvm' + when: (hostvars[item]['vendor'] | lower != 'kvm') and (hostvars[item]['vendor'] | lower != 'pxe') loop: "{{ groups['nodes'] }}" - name: Ensure service hosts are reachable