Skip to content

Commit

Permalink
Don't set ansible_host for 'blank' or managed: false vms
Browse files Browse the repository at this point in the history
When generating networking data, don't add `ansible_host` for VMs
that have a 'blank' image or is marked as `managed: false` to the
inventory. Adding `ansible_host` for these VMs will cause facts
gathering to be triggered by network_mapper later, which raises
unreachable error.
  • Loading branch information
hjensas authored and openshift-merge-bot[bot] committed Sep 11, 2024
1 parent f6fcd02 commit 76a5a85
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion roles/libvirt_manager/tasks/generate_networking_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,17 @@
_cifmw_libvirt_manager_layout.vms[_vm_type].admin_user |
default('zuul')
}}
_add_ansible_host: >-
{{
_cifmw_libvirt_manager_layout.vms[_vm_type].manage | default(true) and
_cifmw_libvirt_manager_layout.vms[_vm_type].disk_file_name | default(_vm_type is not none) != 'blank'
}}
_ansible_host: "{{ _hostname }}.{{ inventory_hostname }}"
ansible.builtin.add_host:
name: "{{ item.key | replace('_', '-') }}"
groups: "{{ _group }}s"
ansible_ssh_user: "{{ _ssh_user }}"
ansible_host: "{{ _hostname }}.{{ inventory_hostname }}"
ansible_host: "{{ _add_ansible_host | ternary(_ansible_host, omit) }}"
vm_type: "{{ _group }}"
loop: "{{ cifmw_libvirt_manager_mac_map | dict2items }}"
loop_control:
Expand Down

0 comments on commit 76a5a85

Please sign in to comment.