Skip to content

Commit

Permalink
Use NetCat instead of ping to test BMC connection, also don't require…
Browse files Browse the repository at this point in the history
… it for PXE
  • Loading branch information
gojeaqui authored and nocturnalastro committed Nov 28, 2023
1 parent 111f215 commit 267e7c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions roles/validate_inventory/tasks/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions roles/validate_inventory/tasks/network.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 267e7c4

Please sign in to comment.