diff --git a/roles/libvirt_manager/tasks/generate_networking_data.yml b/roles/libvirt_manager/tasks/generate_networking_data.yml index 73c64ac6d3..ad61865c8c 100644 --- a/roles/libvirt_manager/tasks/generate_networking_data.yml +++ b/roles/libvirt_manager/tasks/generate_networking_data.yml @@ -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: