On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanc...@abes.fr> wrote:

> Hello gianluca,
>
[snip]

> PS: Something else that may help, try to hack the ovirt4.py with
> ansible_host if you want to call the hosts into playbook by the hostname
> and not the first IP:
>
> vi
> /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py
> 'affinity_labels': [label.name for label in labels],
> ## ajout NBT pour obtenir le nom de l'hote a la place de l ip
> 'ansible_host': vm.name,
> 'affinity_groups': [
>
>
>
Hello,
coming back to this PS of yours.
in my case vm.name is not always resolvable, so it is not so feasible.
But also the default configuration of ansible_host seems quite
unfortunate....
With the default configuration, I see that for VMs with 2 ips, it gets the
eth1 one, not matching the VM hostname and so the job fails because of
unreachable host.
So I'm trying
substituting 
/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py

from
    return {
        'id': vm.id,
        'name': vm.name,
...
        'devices': dict(
            (device.name, [ip.address for ip in device.ips]) for device in
devices if device.ips
        ),
        'ansible_host': next((device.ips[0].address for device in devices
if device.ips), None)
    }

to:
    return {
        'id': vm.id,
        'name': vm.name,
...
        'devices': dict(
            (device.name, [ip.address for ip in device.ips]) for device in
devices if device.ips
        ),
        'ansible_host': vm.fqdn
    }

If I do this with my test tmp file I see that comparing output of command

(py36) bash-4.4# ./ovirt4.py

I have a new value for ansible_host, matching the fqdn of the VM
But going into awx, the job continues to fail and also if I go to inventory
-> sources and sync, even if I check all the "update options":
OVERWRITE
OVERWRITE VARIABLES
UPDATE ON LAUNCH

Still the vm contains ansible_host with the old value, matching the second
interface and not the fqdn...

Any suggestion?

Gianluca
_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/USHA7BGPSOOZG7PN3I2S2YMULGWUN6WM/

Reply via email to