0

I want to deploy an ovirt template with Ansible, but the problem is that when I want to apply the cloud-init the template displays a different network interface file name every time, that is,

sometimes it is eth0, other times ens33 etc. How could I get this information to be able to apply the cloud init correctly.

Thank you.

  • 1
    Explore all the facts returned by your host with `ansible -i inventory.ini your_host -m setup`..`ansible_default_ipv4.interface` might be a good guess, You should be able to find the exact match your are looking for. `ansible_interfaces` is also a good variable to look at. You will probably need to find your way. – Zeitounator May 13 '20 at 19:27
  • The problem is that I have no connection to the machine and before that I have to launch the cloud init against the corresponding interface – Antonio Jimenez May 14 '20 at 08:24
  • Did my answer resolve your question? – Martin Nečas May 21 '20 at 18:05

1 Answers1

0

How about the ovirt_nic_info module?

If you need to gather data there are many ovirt _info modules.

If you have further issues/questions you can open an issue on https://github.com/ovirt/ovirt-ansible-collection

- ovirt_nic_info:
    auth: "{{ ovirt_auth }}"
    vm: centos8
  register: result
- debug:
    msg: "{{ result.ovirt_nics[0].reported_devices[0].name }}"
Martin Nečas
  • 593
  • 2
  • 9