AWX and error using ovirt as an inventory source

Hello, I have awx 9.0.1 and ansible 2.8.5 in container of a CentOS 7.7 server. I'm trying to use oVirt 4.3.6.7-1.el7 as a source of an inventory in awx but I get error when syncing Find at bottom below the error messages. I see that in recent past (around June this year) there were some problems, but they should be solved now, correct? There was also a problem in syncing when some powered off VMs were present in oVirt env, but I think this solved too, correct? Any way to replicate / test from command line of awx container? I try some things but in command line I always get error regarding oVirt inventory script requires ovirt-engine-sdk-python >= 4.0.0 that I think depends on not using correct command line and/or not setting needed env. Thanks in advance, Gianluca 2.536 INFO Updating inventory 4: MYDC_OVIRT 3.011 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py 3.013 INFO Using VIRTUAL_ENV: /var/lib/awx/venv/ansible 3.013 INFO Using PATH: /var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 3.013 INFO Using PYTHONPATH: /var/lib/awx/venv/ansible/lib/python3.6/site-packages: Traceback (most recent call last): File "/var/lib/awx/venv/awx/bin/awx-manage", line 11, in <module> load_entry_point('awx==9.0.1.0', 'console_scripts', 'awx-manage')() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/__init__.py", line 158, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1153, in handle raise exc File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1043, in handle venv_path=venv_path, verbosity=self.verbosity).load() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 214, in load return self.command_to_json(base_args + ['--list']) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 197, in command_to_json self.method, proc.returncode, stdout, stderr)) RuntimeError: ansible-inventory failed (rc=1) with stdout: stderr: ansible-inventory 2.8.5 config file = /etc/ansible/ansible.cfg configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible-inventory python version = 3.6.8 (default, Oct 7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] Using /etc/ansible/ansible.cfg as config file [WARNING]: * Failed to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error: File "/usr/lib/python3.6/site-packages/ansible/inventory/manager.py", line 268, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/usr/lib/python3.6/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e)) [WARNING]: Unable to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source ERROR! No inventory was parsed, please check your configuration and options.

Hello gianluca, I reported this issue a long time ago (march of 19) in an unofficial rpm awx project https://github.com/MrMEEE/awx-build/issues/72 All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt* ansible module) fail because of the version of pycurl (worked before 7.19) What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this: * # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt * source /var/lib/awx/venv/ovirt/bin/activate * # (ovirt) export PYCURL_SSL_LIBRARY=nss; pip install pycurl --compile --no-cache-dir * choose this venv instead of the regular in your inventory page and you'll be able to sync 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 forlabelinlabels], ## ajout NBT pour obtenir le nom de l'hote a la place de l ip 'ansible_host': vm.name, 'affinity_groups': [ Le 28/11/2019 à 15:51, Gianluca Cecchi a écrit :
Hello, I have awx 9.0.1 and ansible 2.8.5 in container of a CentOS 7.7 server. I'm trying to use oVirt 4.3.6.7-1.el7 as a source of an inventory in awx but I get error when syncing
Find at bottom below the error messages. I see that in recent past (around June this year) there were some problems, but they should be solved now, correct? There was also a problem in syncing when some powered off VMs were present in oVirt env, but I think this solved too, correct?
Any way to replicate / test from command line of awx container? I try some things but in command line I always get error regarding
oVirt inventory script requires ovirt-engine-sdk-python >= 4.0.0
that I think depends on not using correct command line and/or not setting needed env.
Thanks in advance, Gianluca
2.536 INFO Updating inventory 4: MYDC_OVIRT 3.011 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py 3.013 INFO Using VIRTUAL_ENV: /var/lib/awx/venv/ansible 3.013 INFO Using PATH: /var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 3.013 INFO Using PYTHONPATH: /var/lib/awx/venv/ansible/lib/python3.6/site-packages: Traceback (most recent call last): File "/var/lib/awx/venv/awx/bin/awx-manage", line 11, in <module> load_entry_point('awx==9.0.1.0', 'console_scripts', 'awx-manage')() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/__init__.py", line 158, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1153, in handle raise exc File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1043, in handle venv_path=venv_path, verbosity=self.verbosity).load() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 214, in load return self.command_to_json(base_args + ['--list']) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 197, in command_to_json self.method, proc.returncode, stdout, stderr)) RuntimeError: ansible-inventory failed (rc=1) with stdout: stderr: ansible-inventory 2.8.5 config file = /etc/ansible/ansible.cfg configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible-inventory python version = 3.6.8 (default, Oct 7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] Using /etc/ansible/ansible.cfg as config file [WARNING]: * Failed to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error:
File "/usr/lib/python3.6/site-packages/ansible/inventory/manager.py", line 268, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/usr/lib/python3.6/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e))
[WARNING]: Unable to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source
ERROR! No inventory was parsed, please check your configuration and options.
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@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/DGTCAAC5DZHSKG...
-- Nathanaël Blanchet Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello gianluca,
I reported this issue a long time ago (march of 19) in an unofficial rpm awx project
But I see that it is marked as closed....
All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt* ansible module) fail because of the version of pycurl (worked before 7.19)
You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry
What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this:
- # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt
I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis...
- source /var/lib/awx/venv/ovirt/bin/activate
as root correct? and I should source the just created venv, correct?
- # (ovirt) export PYCURL_SSL_LIBRARY=nss; pip install pycurl --compile --no-cache-dir
I presume (ovirt) is a sort of prompt of the venv
Will the settings preserved across reboot of the server hosting the container?
- choose this venv instead of the regular in your inventory page and you'll be able to sync
I don't see in awx an option to specify a venv or another...
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': [
I will investigate, thanks. Gianluca

Le 28/11/2019 à 17:15, Gianluca Cecchi a écrit :
On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@abes.fr <mailto:blanchet@abes.fr>> wrote:
Hello gianluca,
I reported this issue a long time ago (march of 19) in an unofficial rpm awx project
https://github.com/MrMEEE/awx-build/issues/72
But I see that it is marked as closed.... It's marked as closed for the unofficial RPM project only, not with the regular container deployment.
All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt* ansible module) fail because of the version of pycurl (worked before 7.19)
You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry
What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this:
* # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt
I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis...
sure inside the container, parenthesis are the default parameters so you can use an other path: /opt/rh/rh-python36/root/usr/bin/awx-create-venv -n ovirt -p 2
* source /var/lib/awx/venv/ovirt/bin/activate
as root correct? and I should source the just created venv, correct?
yes
* # (ovirt) export PYCURL_SSL_LIBRARY=nss; pip install pycurl --compile --no-cache-dir
I presume (ovirt) is a sort of prompt of the venv
Will the settings preserved across reboot of the server hosting the container?
yes the setting is inside the container
* choose this venv instead of the regular in your inventory page and you'll be able to sync
I don't see in awx an option to specify a venv or another...
You may need to create a second venv so as the drop down menu to be present.
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 <http://label.name> forlabelinlabels], ## ajout NBT pour obtenir le nom de l'hote a la place de l ip 'ansible_host': vm.name <http://vm.name>, 'affinity_groups': [
I will investigate, thanks. Gianluca
-- Nathanaël Blanchet Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On Thu, Nov 28, 2019 at 5:33 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Le 28/11/2019 à 17:15, Gianluca Cecchi a écrit :
On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello gianluca,
I reported this issue a long time ago (march of 19) in an unofficial rpm awx project
But I see that it is marked as closed....
It's marked as closed for the unofficial RPM project only, not with the regular container deployment.
All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt*
ansible module) fail because of the version of pycurl (worked before 7.19)
You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry
What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this:
- # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt
I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis...
sure inside the container, parenthesis are the default parameters so you can use an other path:
/opt/rh/rh-python36/root/usr/bin/awx-create-venv -n ovirt -p 2
In my awx container I don't
have /opt/rh/rh-python36/root/usr/bin/awx-create-venv and don't have awx-create-venv at all in any path. Not in container based on image ansible/awx_task:9.0.1 nor in container based on image ansible/awx_web:9.0.1 Gianluca

give a try to [ https://awx.wiki/ | https://awx.wiki/ ] based on rpms and not docker if you want to test this feature, it rocks. De: "Gianluca Cecchi" <gianluca.cecchi@gmail.com> À: "Nathanaël Blanchet" <blanchet@abes.fr> Cc: "users" <users@ovirt.org> Envoyé: Jeudi 28 Novembre 2019 19:17:12 Objet: Re: [ovirt-users] AWX and error using ovirt as an inventory source On Thu, Nov 28, 2019 at 5:33 PM Nathanaël Blanchet < [ mailto:blanchet@abes.fr | blanchet@abes.fr ] > wrote: Le 28/11/2019 à 17:15, Gianluca Cecchi a écrit : BQ_BEGIN On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet < [ mailto:blanchet@abes.fr | blanchet@abes.fr ] > wrote: BQ_BEGIN Hello gianluca, I reported this issue a long time ago (march of 19) in an unofficial rpm awx project [ https://github.com/MrMEEE/awx-build/issues/72 | https://github.com/MrMEEE/awx-build/issues/72 ] But I see that it is marked as closed.... BQ_END It's marked as closed for the unofficial RPM project only, not with the regular container deployment. BQ_BEGIN BQ_BEGIN All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt* ansible module) fail because of the version of pycurl (worked before 7.19) BQ_END You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry BQ_BEGIN What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this: * # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt BQ_END I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis... BQ_END sure inside the container, parenthesis are the default parameters so you can use an other path: /opt/rh/rh-python36/root/usr/bin/awx-create-venv -n ovirt -p 2 BQ_BEGIN BQ_END BQ_END In my awx container I don't have /opt/rh/rh-python36/root/usr/bin/awx-create-venv and don't have awx-create-venv at all in any path. Not in container based on image ansible/awx_task:9.0.1 nor in container based on image ansible/awx_web:9.0.1 Gianluca

Hi, I use awx rpm from awx.wiki and followed your directions to create a python2 venv with ansible 2.9.1 and built pycurl with nss, however syncing the inventory still fails : stderr: ansible-inventory 2.9.1 config file = None configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible executable location = /var/lib/awx/venv/ovirt-p2/bin/ansible-inventory python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] No config file found; using defaults setting up inventory plugins [WARNING]: * Failed to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error: File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/inventory/manager.py", line 280, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e)) [WARNING]: Unable to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source Guillaume Pavese Ingénieur Système et Réseau Interactiv-Group On Fri, Nov 29, 2019 at 4:51 AM Nathanaël Blanchet <blanchet@abes.fr> wrote:
give a try to https://awx.wiki/ based on rpms and not docker if you want to test this feature, it rocks.
------------------------------ *De: *"Gianluca Cecchi" <gianluca.cecchi@gmail.com> *À: *"Nathanaël Blanchet" <blanchet@abes.fr> *Cc: *"users" <users@ovirt.org> *Envoyé: *Jeudi 28 Novembre 2019 19:17:12 *Objet: *Re: [ovirt-users] AWX and error using ovirt as an inventory source
On Thu, Nov 28, 2019 at 5:33 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Le 28/11/2019 à 17:15, Gianluca Cecchi a écrit :
On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello gianluca,
I reported this issue a long time ago (march of 19) in an unofficial rpm awx project
But I see that it is marked as closed....
It's marked as closed for the unofficial RPM project only, not with the regular container deployment.
All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt*
ansible module) fail because of the version of pycurl (worked before 7.19)
You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry
What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this:
- # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt
I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis...
sure inside the container, parenthesis are the default parameters so you can use an other path:
/opt/rh/rh-python36/root/usr/bin/awx-create-venv -n ovirt -p 2
In my awx container I don't
have /opt/rh/rh-python36/root/usr/bin/awx-create-venv and don't have awx-create-venv at all in any path. Not in container based on image ansible/awx_task:9.0.1 nor in container based on image ansible/awx_web:9.0.1
Gianluca
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@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/4MSEW7LVC4QOTA...
-- Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. IT, ES, UK. <https://interactiv-group.com/disclaimer.html>

try if you can get a result with plain ovirt4.py execution: cd /tmp rsync -av /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py . cat ovirt.ini [ovirt] ovirt_url = https://engine_fqdn/ovirt-engine/api ovirt_username = admin@internal ovirt_password = passwd ./ovirt4.py Le 29/11/2019 à 09:57, Guillaume Pavese a écrit :
Hi,
I use awx rpm from awx.wiki and followed your directions to create a python2 venv with ansible 2.9.1 and built pycurl with nss, however syncing the inventory still fails :
stderr: ansible-inventory 2.9.1 config file = None configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible executable location = /var/lib/awx/venv/ovirt-p2/bin/ansible-inventory python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] No config file found; using defaults setting up inventory plugins [WARNING]: * Failed to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error:
File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/inventory/manager.py", line 280, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e))
[WARNING]: Unable to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source
Guillaume Pavese IngénieurSystèmeet Réseau Interactiv-Group
On Fri, Nov 29, 2019 at 4:51 AM Nathanaël Blanchet <blanchet@abes.fr <mailto:blanchet@abes.fr>> wrote:
give a try to https://awx.wiki/ based on rpms and not docker if you want to test this feature, it rocks.
------------------------------------------------------------------------ *De: *"Gianluca Cecchi" <gianluca.cecchi@gmail.com <mailto:gianluca.cecchi@gmail.com>> *À: *"Nathanaël Blanchet" <blanchet@abes.fr <mailto:blanchet@abes.fr>> *Cc: *"users" <users@ovirt.org <mailto:users@ovirt.org>> *Envoyé: *Jeudi 28 Novembre 2019 19:17:12 *Objet: *Re: [ovirt-users] AWX and error using ovirt as an inventory source
On Thu, Nov 28, 2019 at 5:33 PM Nathanaël Blanchet <blanchet@abes.fr <mailto:blanchet@abes.fr>> wrote:
Le 28/11/2019 à 17:15, Gianluca Cecchi a écrit :
On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@abes.fr <mailto:blanchet@abes.fr>> wrote:
Hello gianluca,
I reported this issue a long time ago (march of 19) in an unofficial rpm awx project
https://github.com/MrMEEE/awx-build/issues/72
But I see that it is marked as closed....
It's marked as closed for the unofficial RPM project only, not with the regular container deployment.
All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt* ansible module) fail because of the version of pycurl (worked before 7.19)
You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry
What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this:
* # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt
I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis...
sure inside the container, parenthesis are the default parameters so you can use an other path:
/opt/rh/rh-python36/root/usr/bin/awx-create-venv -n ovirt -p 2
In my awx container I don't have /opt/rh/rh-python36/root/usr/bin/awx-create-venv and don't have awx-create-venv at all in any path. Not in container based on image ansible/awx_task:9.0.1 nor in container based on image ansible/awx_web:9.0.1
Gianluca
_______________________________________________ Users mailing list -- users@ovirt.org <mailto:users@ovirt.org> To unsubscribe send an email to users-leave@ovirt.org <mailto:users-leave@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/4MSEW7LVC4QOTA...
Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. IT, ES, UK. <https://interactiv-group.com/disclaimer.html>
-- Nathanaël Blanchet Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

My problem was that I did not fully follow your directions, and had not pip installed ovirt-engine-sdk-python in the virtualenv. Inventory is syncing now in awx. Thanks for the help! Guillaume Pavese Ingénieur Système et Réseau Interactiv-Group On Fri, Nov 29, 2019 at 8:07 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
try if you can get a result with plain ovirt4.py execution:
cd /tmp
rsync -av /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py .
cat ovirt.ini [ovirt] ovirt_url = https://engine_fqdn/ovirt-engine/api ovirt_username = admin@internal ovirt_password = passwd
./ovirt4.py
Le 29/11/2019 à 09:57, Guillaume Pavese a écrit :
Hi,
I use awx rpm from awx.wiki and followed your directions to create a python2 venv with ansible 2.9.1 and built pycurl with nss, however syncing the inventory still fails :
stderr: ansible-inventory 2.9.1 config file = None configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible executable location = /var/lib/awx/venv/ovirt-p2/bin/ansible-inventory python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] No config file found; using defaults setting up inventory plugins [WARNING]: * Failed to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error:
File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/inventory/manager.py", line 280, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e))
[WARNING]: Unable to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source
Guillaume Pavese Ingénieur Système et Réseau Interactiv-Group
On Fri, Nov 29, 2019 at 4:51 AM Nathanaël Blanchet <blanchet@abes.fr> wrote:
give a try to https://awx.wiki/ based on rpms and not docker if you want to test this feature, it rocks.
------------------------------ *De: *"Gianluca Cecchi" <gianluca.cecchi@gmail.com> *À: *"Nathanaël Blanchet" <blanchet@abes.fr> *Cc: *"users" <users@ovirt.org> *Envoyé: *Jeudi 28 Novembre 2019 19:17:12 *Objet: *Re: [ovirt-users] AWX and error using ovirt as an inventory source
On Thu, Nov 28, 2019 at 5:33 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Le 28/11/2019 à 17:15, Gianluca Cecchi a écrit :
On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello gianluca,
I reported this issue a long time ago (march of 19) in an unofficial rpm awx project
But I see that it is marked as closed....
It's marked as closed for the unofficial RPM project only, not with the regular container deployment.
All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt*
ansible module) fail because of the version of pycurl (worked before 7.19)
You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry
What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this:
- # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt
I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis...
sure inside the container, parenthesis are the default parameters so you can use an other path:
/opt/rh/rh-python36/root/usr/bin/awx-create-venv -n ovirt -p 2
In my awx container I don't
have /opt/rh/rh-python36/root/usr/bin/awx-create-venv and don't have awx-create-venv at all in any path. Not in container based on image ansible/awx_task:9.0.1 nor in container based on image ansible/awx_web:9.0.1
Gianluca
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@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/4MSEW7LVC4QOTA...
Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. IT, ES, UK. <https://interactiv-group.com/disclaimer.html>
-- Nathanaël Blanchet
Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14blanchet@abes.fr
-- Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. IT, ES, UK. <https://interactiv-group.com/disclaimer.html>

Great, I hope Gianluca will be able to sync with the container version! De: "Guillaume Pavese" <guillaume.pavese@interactiv-group.com> À: "Nathanaël Blanchet" <blanchet@abes.fr> Cc: "Gianluca Cecchi" <gianluca.cecchi@gmail.com>, "users" <users@ovirt.org> Envoyé: Mardi 3 Décembre 2019 04:07:53 Objet: Re: [ovirt-users] Re: AWX and error using ovirt as an inventory source My problem was that I did not fully follow your directions, and had not pip installed ovirt-engine-sdk-python in the virtualenv. Inventory is syncing now in awx. Thanks for the help! Guillaume Pavese Ingénieur Système et Réseau Interactiv-Group On Fri, Nov 29, 2019 at 8:07 PM Nathanaël Blanchet < [ mailto:blanchet@abes.fr | blanchet@abes.fr ] > wrote: try if you can get a result with plain ovirt4.py execution: cd /tmp rsync -av /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py . cat ovirt.ini [ovirt] ovirt_url = [ https://engine_fqdn/ovirt-engine/api | https://engine_fqdn/ovirt-engine/api ] ovirt_username = admin@internal ovirt_password = passwd ./ovirt4.py Le 29/11/2019 à 09:57, Guillaume Pavese a écrit : BQ_BEGIN Hi, I use awx rpm from awx.wiki and followed your directions to create a python2 venv with ansible 2.9.1 and built pycurl with nss, however syncing the inventory still fails : stderr: ansible-inventory 2.9.1 config file = None configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible executable location = /var/lib/awx/venv/ovirt-p2/bin/ansible-inventory python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] No config file found; using defaults setting up inventory plugins [WARNING]: * Failed to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error: File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/inventory/manager.py", line 280, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e)) [WARNING]: Unable to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source Guillaume Pavese Ingénieur Système et Réseau Interactiv-Group On Fri, Nov 29, 2019 at 4:51 AM Nathanaël Blanchet < [ mailto:blanchet@abes.fr | blanchet@abes.fr ] > wrote: BQ_BEGIN give a try to [ https://awx.wiki/ | https://awx.wiki/ ] based on rpms and not docker if you want to test this feature, it rocks. De: "Gianluca Cecchi" < [ mailto:gianluca.cecchi@gmail.com | gianluca.cecchi@gmail.com ] > À: "Nathanaël Blanchet" < [ mailto:blanchet@abes.fr | blanchet@abes.fr ] > Cc: "users" < [ mailto:users@ovirt.org | users@ovirt.org ] > Envoyé: Jeudi 28 Novembre 2019 19:17:12 Objet: Re: [ovirt-users] AWX and error using ovirt as an inventory source On Thu, Nov 28, 2019 at 5:33 PM Nathanaël Blanchet < [ mailto:blanchet@abes.fr | blanchet@abes.fr ] > wrote: BQ_BEGIN Le 28/11/2019 à 17:15, Gianluca Cecchi a écrit : BQ_BEGIN On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet < [ mailto:blanchet@abes.fr | blanchet@abes.fr ] > wrote: BQ_BEGIN Hello gianluca, I reported this issue a long time ago (march of 19) in an unofficial rpm awx project [ https://github.com/MrMEEE/awx-build/issues/72 | https://github.com/MrMEEE/awx-build/issues/72 ] But I see that it is marked as closed.... BQ_END It's marked as closed for the unofficial RPM project only, not with the regular container deployment. BQ_BEGIN BQ_BEGIN All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt* ansible module) fail because of the version of pycurl (worked before 7.19) BQ_END You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry BQ_BEGIN What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this: * # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt BQ_END I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis... BQ_END sure inside the container, parenthesis are the default parameters so you can use an other path: /opt/rh/rh-python36/root/usr/bin/awx-create-venv -n ovirt -p 2 BQ_BEGIN BQ_END BQ_END In my awx container I don't have /opt/rh/rh-python36/root/usr/bin/awx-create-venv and don't have awx-create-venv at all in any path. Not in container based on image ansible/awx_task:9.0.1 nor in container based on image ansible/awx_web:9.0.1 Gianluca _______________________________________________ Users mailing list -- [ mailto:users@ovirt.org | users@ovirt.org ] To unsubscribe send an email to [ mailto:users-leave@ovirt.org | users-leave@ovirt.org ] Privacy Statement: [ https://www.ovirt.org/site/privacy-policy/ | https://www.ovirt.org/site/privacy-policy/ ] oVirt Code of Conduct: [ https://www.ovirt.org/community/about/community-guidelines/ | https://www.ovirt.org/community/about/community-guidelines/ ] List Archives: [ https://lists.ovirt.org/archives/list/users@ovirt.org/message/4MSEW7LVC4QOTA... | https://lists.ovirt.org/archives/list/users@ovirt.org/message/4MSEW7LVC4QOTA... ] BQ_END Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. [ https://interactiv-group.com/disclaimer.html | IT, ES, UK. ] BQ_END -- Nathanaël Blanchet Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 [ mailto:blanchet@abes.fr | blanchet@abes.fr ] BQ_END Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. [ https://interactiv-group.com/disclaimer.html | IT, ES, UK. ]

On Tue, Dec 3, 2019 at 3:02 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Great, I hope Gianluca will be able to sync with the container version!
Unfortunately not yet. When running with the new virtual env I get: 2.352 INFO Updating inventory 4: MYDC_OVIRT 2.825 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx /lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py Traceback (most recent call last): File "/var/lib/awx/venv/awx/bin/awx-manage", line 11, in <module> load_entry_point('awx==9.0.1.0', 'console_scripts', 'awx-manage')() ... File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 101, in build_env for version in os.listdir(venv_libdir): FileNotFoundError: [Errno 2] No such file or directory: '/opt/my-envs/ovirt/lib' But I have this: bash-4.4# ls -l /opt/my-envs/ovirt/ total 4 drwxr-xr-x 2 root root 4096 Nov 30 11:20 bin drwxr-xr-x 2 root root 23 Nov 30 10:56 include drwxr-xr-x 3 root root 23 Nov 30 10:56 lib lrwxrwxrwx 1 root root 3 Nov 30 10:56 lib64 -> lib drwxr-xr-x 3 root root 17 Nov 30 11:07 share bash-4.4# ls -l /opt/my-envs/ovirt/lib total 4 drwxr-xr-x 4 root root 4096 Nov 30 10:56 python2.7 bash-4.4# What I'm missing in your opinion? I don't understand the FileNotFoundError.... Thanks in advance, Gianluca

Could it be a rights problem, ie your awx user can not access to /opt/my-envs? You could try to create the ovirt virtualenv in the default path : /var/lib/awx/venv/ Guillaume Pavese Ingénieur Système et Réseau Interactiv-Group On Wed, Dec 4, 2019 at 5:32 PM Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
On Tue, Dec 3, 2019 at 3:02 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Great, I hope Gianluca will be able to sync with the container version!
Unfortunately not yet. When running with the new virtual env I get:
2.352 INFO Updating inventory 4: MYDC_OVIRT 2.825 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx /lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py Traceback (most recent call last): File "/var/lib/awx/venv/awx/bin/awx-manage", line 11, in <module> load_entry_point('awx==9.0.1.0', 'console_scripts', 'awx-manage')() ... File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 101, in build_env for version in os.listdir(venv_libdir): FileNotFoundError: [Errno 2] No such file or directory: '/opt/my-envs/ovirt/lib'
But I have this:
bash-4.4# ls -l /opt/my-envs/ovirt/ total 4 drwxr-xr-x 2 root root 4096 Nov 30 11:20 bin drwxr-xr-x 2 root root 23 Nov 30 10:56 include drwxr-xr-x 3 root root 23 Nov 30 10:56 lib lrwxrwxrwx 1 root root 3 Nov 30 10:56 lib64 -> lib drwxr-xr-x 3 root root 17 Nov 30 11:07 share bash-4.4# ls -l /opt/my-envs/ovirt/lib total 4 drwxr-xr-x 4 root root 4096 Nov 30 10:56 python2.7 bash-4.4#
What I'm missing in your opinion? I don't understand the FileNotFoundError.... Thanks in advance, Gianluca
-- Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. IT, ES, UK. <https://interactiv-group.com/disclaimer.html>

On Wed, Dec 4, 2019 at 10:40 AM Guillaume Pavese < guillaume.pavese@interactiv-group.com> wrote:
Could it be a rights problem, ie your awx user can not access to /opt/my-envs? You could try to create the ovirt virtualenv in the default path : /var/lib/awx/venv/
I don't know but it doesn't seems so. If I get the /api/v2/settings/system/ page I see
import ovirtsdk4 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/my-envs/ovirt/lib/python2.7/site-packages/ovirtsdk4/__init__.py",
"CUSTOM_VENV_PATHS": [ "/opt/my-envs" ], so it seems it is there. I'm doing some further pre-tests base on what Nathanaël suggested in a reply before: bash-4.4# source /opt/my-envs/ovirt/bin/activate (ovirt) bash-4.4# python -V Python 2.7.15 (ovirt) bash-4.4# (ovirt) bash-4.4# cd /tmp (ovirt) bash-4.4# rsync -ac /var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py . (ovirt) bash-4.4# setup ovirt.ini file (ovirt) bash-4.4# ./ovirt4.py oVirt inventory script requires ovirt-engine-sdk-python >= 4.0.0 (ovirt) bash-4.4# why? I do have this: /opt/my-envs/ovirt/lib/python2.7/site-packages/ovirtsdk4 (ovirt) bash-4.4# ll /opt/my-envs/ovirt/lib/python2.7/site-packages/ovirtsdk4 total 5864 -rw-r--r-- 1 root root 1711 Nov 30 11:23 http.py -rw-r--r-- 1 root root 1718 Nov 30 11:23 http.pyc -rw-r--r-- 1 root root 35322 Nov 30 11:23 __init__.py -rw-r--r-- 1 root root 32118 Nov 30 11:23 __init__.pyc -rw-r--r-- 1 root root 10627 Nov 30 11:23 reader.py -rw-r--r-- 1 root root 11038 Nov 30 11:23 reader.pyc -rw-r--r-- 1 root root 591736 Nov 30 11:23 readers.py -rw-r--r-- 1 root root 420862 Nov 30 11:23 readers.pyc -rw-r--r-- 1 root root 11080 Nov 30 11:23 service.py -rw-r--r-- 1 root root 10836 Nov 30 11:23 service.pyc -rw-r--r-- 1 root root 1243244 Nov 30 11:23 services.py -rw-r--r-- 1 root root 1200541 Nov 30 11:23 services.pyc -rw-r--r-- 1 root root 594910 Nov 30 11:23 types.py -rw-r--r-- 1 root root 851939 Nov 30 11:23 types.pyc -rw-r--r-- 1 root root 827 Nov 30 11:23 version.py -rw-r--r-- 1 root root 233 Nov 30 11:23 version.pyc -rw-r--r-- 1 root root 6661 Nov 30 11:23 writer.py -rw-r--r-- 1 root root 6219 Nov 30 11:23 writer.pyc -rw-r--r-- 1 root root 433610 Nov 30 11:23 writers.py -rw-r--r-- 1 root root 387104 Nov 30 11:23 writers.pyc -rwxr-xr-x 1 root root 113096 Nov 30 11:23 xml.so (ovirt) bash-4.4# Another test: (ovirt) bash-4.4# python Python 2.7.15 (default, Oct 8 2019, 21:08:29) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. line 22, in <module> import pycurl ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (nss)
quit() (ovirt) bash-4.4#
What about mismatch link-time ssl backend and compile-time ssl backend? It seems that curl is with ssl and not nss: (ovirt) bash-4.4# curl-config --configure '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--disable-static' '--enable-symbol-hiding' '--enable-ipv6' '--enable-threaded-resolver' '--with-gssapi' '--with-nghttp2' '--with-ssl' '--with-ca-bundle=/etc/pki/tls/certs/ca-bundle.crt' '--enable-ldap' '--enable-ldaps' '--enable-manual' '--with-brotli' '--with-libidn2' '--with-libmetalink' '--with-libpsl' '--with-libssh' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' 'LDFLAGS=-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' (ovirt) bash-4.4# (ovirt) bash-4.4# ldd /usr/bin/curl linux-vdso.so.1 (0x00007ffd420e6000) libcurl.so.4 => /lib64/libcurl.so.4 (0x00007ff6a6c11000) libmetalink.so.3 => /lib64/libmetalink.so.3 (0x00007ff6a6a00000) libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007ff6a676d000) libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007ff6a6295000) libz.so.1 => /lib64/libz.so.1 (0x00007ff6a607e000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff6a5e5e000) libc.so.6 => /lib64/libc.so.6 (0x00007ff6a5a9a000) libnghttp2.so.14 => /lib64/libnghttp2.so.14 (0x00007ff6a5874000) libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007ff6a5624000) libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007ff6a5334000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007ff6a5118000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007ff6a4f14000) libexpat.so.1 => /lib64/libexpat.so.1 (0x00007ff6a4cd9000) libdl.so.2 => /lib64/libdl.so.2 (0x00007ff6a4ad5000) /lib64/ld-linux-x86-64.so.2 (0x00007ff6a70ce000) libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007ff6a48c5000) libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007ff6a46c1000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00007ff6a44aa000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007ff6a4280000) libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007ff6a3ffc000) (ovirt) bash-4.4# So no NSS does this mean I have to deinstall/configure/recompile/install my curl/libcurl?

Actually it seems I was using the wrong container... so explaining why I got the not found error about /opt/my-envs/ovirt/lib ... ;-) I was working on ansible/awx_web:9.0.1 container, while it seems I have to work ansible/awx_task:9.0.1 After doing same steps on this container I get now this kind of error at the end while using apparently the correct virtualenv: 2.429 INFO Updating inventory 4: MYDC_OVIRT 3.257 DEBUG Using base command: python /opt/my-envs/ovirt/bin/ansible-inventory -i /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py --playbook-dir /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory -vvvvv 3.257 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py 3.259 INFO Using VIRTUAL_ENV: /opt/my-envs/ovirt/ 3.260 INFO Using PATH: /opt/my-envs/ovirt/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 3.260 INFO Using PYTHONPATH: /opt/my-envs/ovirt/lib/python2.7/site-packages: Traceback (most recent call last): File "/var/lib/awx/venv/awx/bin/awx-manage", line 11, in <module> load_entry_point('awx==9.0.1.0', 'console_scripts', 'awx-manage')() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/__init__.py", line 158, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1153, in handle raise exc File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1043, in handle venv_path=venv_path, verbosity=self.verbosity).load() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 214, in load return self.command_to_json(base_args + ['--list']) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 197, in command_to_json self.method, proc.returncode, stdout, stderr)) RuntimeError: ansible-inventory failed (rc=1) with stdout: stderr: ansible-inventory 2.9.2 config file = /etc/ansible/ansible.cfg configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /opt/my-envs/ovirt/lib/python2.7/site-packages/ansible executable location = /opt/my-envs/ovirt/bin/ansible-inventory python version = 2.7.15 (default, Oct 8 2019, 21:08:29) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] Using /etc/ansible/ansible.cfg as config file setting up inventory plugins [WARNING]: * Failed to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error: File "/opt/my-envs/ovirt/lib/python2.7/site-packages/ansible/inventory/manager.py", line 280, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/opt/my-envs/ovirt/lib/python2.7/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e)) [WARNING]: Unable to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source ERROR! No inventory was parsed, please check your configuration and options. Ideas?

Okay I got it! container version is slightly different from awx-rpm. All happen in awx_web container. You must use persistent volume so as to use venv and project data over ephemeral container. You must use python 3 with ansible 2.9.x cd installer && vi inventory custom_venv_dir = /opt/my-envs project_data_dir = /var/lib/awx/projects you can run installer ansible-playbook -i inventory install.yml check mounts docker inspect -f "{{ .Mounts }}" awx_web [{bind /opt/my-envs /opt/my-envs rw true rprivate} {bind /var/lib/awx/projects /var/lib/awx/projects rw true rprivate}] Right from now, you modify the container itself, becareful data are not persistent along container lifecycle, so what follows is for POC. You should build your own container image with this wanted parameters. yum install -y make gcc redhat-rpm-config python3-devel libcurl-devel libxml2-devel source /opt/my-envs/py36/bin/activate pip install psutil export PYCURL_SSL_LIBRARY = openssl ; pip install pycurl --compile --no-cache-dir pip install ansible ovirt-engine-sdk-python centreonapi dnspython select the py36 venv into the source to sync and it should work De: "Gianluca Cecchi" <gianluca.cecchi@gmail.com> À: "Guillaume Pavese" <guillaume.pavese@interactiv-group.com> Cc: "Nathanaël Blanchet" <blanchet@abes.fr>, "users" <users@ovirt.org> Envoyé: Vendredi 6 Décembre 2019 13:40:45 Objet: Re: [ovirt-users] Re: AWX and error using ovirt as an inventory source Actually it seems I was using the wrong container... so explaining why I got the not found error about /opt/my-envs/ovirt/lib ... ;-) I was working on ansible/awx_web:9.0.1 container, while it seems I have to work ansible/awx_task:9.0.1 After doing same steps on this container I get now this kind of error at the end while using apparently the correct virtualenv: 2.429 INFO Updating inventory 4: MYDC_OVIRT 3.257 DEBUG Using base command: python /opt/my-envs/ovirt/bin/ansible-inventory -i /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py --playbook-dir /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory -vvvvv 3.257 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py 3.259 INFO Using VIRTUAL_ENV: /opt/my-envs/ovirt/ 3.260 INFO Using PATH: /opt/my-envs/ovirt/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 3.260 INFO Using PYTHONPATH: /opt/my-envs/ovirt/lib/python2.7/site-packages: Traceback (most recent call last): File "/var/lib/awx/venv/awx/bin/awx-manage", line 11, in <module> load_entry_point('awx==9.0.1.0', 'console_scripts', 'awx-manage')() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/__init__.py", line 158, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1153, in handle raise exc File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1043, in handle venv_path=venv_path, verbosity=self.verbosity).load() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 214, in load return self.command_to_json(base_args + ['--list']) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 197, in command_to_json self.method, proc.returncode, stdout, stderr)) RuntimeError: ansible-inventory failed (rc=1) with stdout: stderr: ansible-inventory 2.9.2 config file = /etc/ansible/ansible.cfg configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /opt/my-envs/ovirt/lib/python2.7/site-packages/ansible executable location = /opt/my-envs/ovirt/bin/ansible-inventory python version = 2.7.15 (default, Oct 8 2019, 21:08:29) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] Using /etc/ansible/ansible.cfg as config file setting up inventory plugins [WARNING]: * Failed to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error: File "/opt/my-envs/ovirt/lib/python2.7/site-packages/ansible/inventory/manager.py", line 280, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/opt/my-envs/ovirt/lib/python2.7/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e)) [WARNING]: Unable to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source ERROR! No inventory was parsed, please check your configuration and options. Ideas?

On Fri, Dec 13, 2019 at 11:50 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Okay I got it!
Thanks for your time ;-)
container version is slightly different from awx-rpm. All happen in awx_web container. You must use persistent volume so as to use venv and project data over ephemeral container. You must use python 3 with ansible 2.9.x
OK. I scratched and started form a clean environment cd installer && vi inventory
custom_venv_dir=/opt/my-envs project_data_dir=/var/lib/awx/projects
done
you can run installer ansible-playbook -i inventory install.yml
done
check mounts docker inspect -f "{{ .Mounts }}" awx_web [{bind /opt/my-envs /opt/my-envs rw true rprivate} {bind /var/lib/awx/projects /var/lib/awx/projects rw true rprivate}]
confirmed
Right from now, you modify the container itself, becareful data are not persistent along container lifecycle, so what follows is for POC. You should build your own container image with this wanted parameters.
ok, this will be next step of configuration phase, after verifying all is ok. Suggestions?
yum install -y make gcc redhat-rpm-config python3-devel libcurl-devel libxml2-devel
This command above puts in these packages: Installing: gcc x86_64 8.2.1-3.5.el8 AppStream 23 M libxml2-devel x86_64 2.9.7-5.el8 AppStream 1.0 M python36-devel x86_64 3.6.8-2.module_el8.0.0+33+0a10c0e1 AppStream 16 k redhat-rpm-config noarch 116-1.el8.0.1 AppStream 82 k libcurl-devel x86_64 7.61.1-8.el8 BaseOS 820 k Installing dependencies: annobin x86_64 8.64-1.el8 AppStream 187 k cmake-filesystem x86_64 3.11.4-3.el8 AppStream 40 k cpp x86_64 8.2.1-3.5.el8 AppStream 10 M dwz x86_64 0.12-9.el8 AppStream 109 k efi-srpm-macros noarch 3-2.el8 AppStream 22 k ghc-srpm-macros noarch 1.4.2-7.el8 AppStream 9.3 k go-srpm-macros noarch 2-16.el8 AppStream 14 k isl x86_64 0.16.1-6.el8 AppStream 841 k libmpc x86_64 1.0.2-9.el8 AppStream 59 k ocaml-srpm-macros noarch 5-4.el8 AppStream 9.4 k openblas-srpm-macros noarch 2-2.el8 AppStream 7.9 k perl-srpm-macros noarch 1-25.el8 AppStream 11 k platform-python-devel x86_64 3.6.8-4.el8_0 AppStream 242 k python-rpm-macros noarch 3-37.el8 AppStream 14 k python-srpm-macros noarch 3-37.el8 AppStream 14 k python3-rpm-generators noarch 5-4.el8 AppStream 24 k python3-rpm-macros noarch 3-37.el8 AppStream 13 k qt5-srpm-macros noarch 5.11.1-2.el8 AppStream 11 k rust-srpm-macros noarch 5-2.el8 AppStream 9.2 k file x86_64 5.33-8.el8 BaseOS 76 k glibc-devel x86_64 2.28-42.el8.1 BaseOS 1.0 M glibc-headers x86_64 2.28-42.el8.1 BaseOS 465 k kernel-headers x86_64 4.18.0-80.11.2.el8_0 BaseOS 1.6 M libgomp x86_64 8.2.1-3.5.el8 BaseOS 189 k libxcrypt-devel x86_64 4.1.1-4.el8 BaseOS 25 k xz-devel x86_64 5.2.4-3.el8 BaseOS 62 k zip x86_64 3.0-23.el8 BaseOS 270 k zlib-devel x86_64 1.2.11-10.el8 BaseOS 56 k
source /opt/my-envs/py36/bin/activate
before this step I have to create the virtualenv, so I executed: bash-4.4# virtualenv /opt/my-envs/py36 Using base prefix '/usr' No LICENSE.txt / LICENSE found in source New python executable in /opt/my-envs/py36/bin/python3.6 Also creating executable in /opt/my-envs/py36/bin/python Installing setuptools, pip, wheel... done. bash-4.4# and then: bash-4.4# source /opt/my-envs/py36/bin/activate (py36) bash-4.4# pip install psutil
ok. Got: Successfully installed psutil-5.6.7 export PYCURL_SSL_LIBRARY=openssl; pip install pycurl --compile
--no-cache-dir
This got a problem with missing openssl-devel: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYCURL_VERSION="7.43.0.3" -DHAVE_CURL_SSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/usr/include/python3.6m -c src/docstrings.c -o build/temp.linux-x86_64-3.6/src/docstrings.o In file included from src/docstrings.c:4: src/pycurl.h:164:13: fatal error: openssl/ssl.h: No such file or directory # include <openssl/ssl.h> So: (py36) bash-4.4# yum install openssl-devel Last metadata expiration check: 0:07:33 ago on Mon 16 Dec 2019 03:27:05 PM UTC. Dependencies resolved. ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: openssl-devel x86_64 1:1.1.1-8.el8 BaseOS 2.3 M Installing dependencies: keyutils-libs-devel x86_64 1.5.10-6.el8 BaseOS 48 k krb5-devel x86_64 1.16.1-22.el8 BaseOS 546 k libcom_err-devel x86_64 1.44.3-2.el8 BaseOS 37 k libselinux-devel x86_64 2.8-6.el8 BaseOS 199 k libsepol-devel x86_64 2.8-2.el8 BaseOS 85 k libverto-devel x86_64 0.3.0-5.el8 BaseOS 18 k pcre2-devel x86_64 10.32-1.el8 BaseOS 605 k pcre2-utf16 x86_64 10.32-1.el8 BaseOS 228 k pcre2-utf32 x86_64 10.32-1.el8 BaseOS 220 k and then: Successfully installed pycurl-7.43.0.3 pip install ansible ovirt-engine-sdk-python centreonapi dnspython
ok. Got: Successfully installed MarkupSafe-1.1.1 PyYAML-5.2 ansible-2.9.2 beautifulsoup4-4.8.1 bs4-0.0.1 centreonapi-0.1.7 certifi-2019.11.28 cffi-1.13.2 chardet-3.0.4 cryptography-2.8 dnspython-1.16.0 idna-2.8 jinja2-2.10.3 ovirt-engine-sdk-python-4.4.0 pycparser-2.19 requests-2.22.0 six-1.13.0 soupsieve-1.9.5 urllib3-1.25.7 select the py36 venv into the source to sync and it should work
Now I don't see yet the option of choosing the virtualenv. I was indeed able to run: (py36) bash-4.4# cd /tmp (py36) bash-4.4# mkdir p (py36) bash-4.4# cd p (py36) bash-4.4# rsync -av /var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py . create file ovirt.ini with information about oVirt env: (py36) bash-4.4# ./ovirt4.py { "cluster_Z2Z3-OV-10G": [ "c76", "c76client", "enginecopy1", "enginemaster", "hostcopy1", "hostmaster", "miq", "mydbsrv", "mydbsrv_04-2018_clone", "p2vorasvi11", "p2vorasvi22" ], "status_down": [ ... So I think we are closer. I only need to enable the py36 virtual env in Tower now... Tried (py36) bash-4.4# ansible-tower-service restart Restarting Tower (py36) bash-4.4# but still in my source I don't see the option to choose virtual env.... so I use the post via curl. In fact if I go to: https://my_awx/api/v2/settings/system/ I have "CUSTOM_VENV_PATHS": [], $ curl -k -X PATCH 'https://my_user:my_pwd@my_awx/api/v2/settings/system/' -d '{"CUSTOM_VENV_PATHS": ["/opt/my-envs/"]}' -H 'Content-Type:application/json' {"ACTIVITY_STREAM_ENABLED":true,"ACTIVITY_STREAM_ENABLED_FOR_INVENTORY_SYNC":false,"ORG_ADMINS_CAN_SEE_ALL_USERS":true,"MANAGE_ORGANIZATION_AUTH":true,"TOWER_URL_BASE":" https://towerhost ","REMOTE_HOST_HEADERS":["REMOTE_ADDR","REMOTE_HOST"],"PROXY_IP_WHITELIST":[],"LICENSE":{},"REDHAT_USERNAME":"","REDHAT_PASSWORD":"","AUTOMATION_ANALYTICS_URL":" https://example.com ","INSTALL_UUID":"ab78df41-4154-49be-9edb-caad5ec80908","CUSTOM_VENV_PATHS":["/opt/my-envs"],"INSIGHTS_TRACKING_STATE":false,"BROKER_DURABILITY":true} $ and now I'm finally able to see the virtualenv drop down in my ovirt source and choose the py36 one. Saving the source and syncing: 2.634 INFO Updating inventory 2: ovmgr1 3.534 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py 3.537 INFO Using VIRTUAL_ENV: /opt/my-envs/py36/ 3.537 INFO Using PATH: /opt/my-envs/py36/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 3.537 INFO Using PYTHONPATH: /opt/my-envs/py36/lib/python3.6/site-packages: 5.715 ERROR ansible-inventory 2.9.2 5.716 ERROR config file = /etc/ansible/ansible.cfg 5.716 ERROR configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] 5.716 ERROR ansible python module location = /opt/my-envs/py36/lib/python3.6/site-packages/ansible 5.716 ERROR executable location = /opt/my-envs/py36/bin/ansible-inventory 5.716 ERROR python version = 3.6.8 (default, Oct 7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] 5.716 ERROR Using /etc/ansible/ansible.cfg as config file 5.716 ERROR [WARNING]: Invalid characters were found in group names but not replaced, use 5.716 ERROR -vvvv to see details 5.716 ERROR 5.716 ERROR Parsed /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py inventory source with script plugin 5.716 INFO Processing JSON output... 5.717 INFO Loaded 2 groups, 11 hosts 2019-12-16 16:26:59,390 DEBUG awx.main.models.inventory Going to update inventory computed fields, pk=2 2019-12-16 16:26:59,563 DEBUG awx.main.models.inventory Finished updating inventory computed fields, pk=2, in 0.172 seconds 6.055 INFO Inventory import completed for ovmgr1 in 3.4s I haven't understood the errors, but all my 11 VMs (all powered off at the moment...) have been imported and I see them as hosts in this inventory... Eureka! And a big thank you for the moment! IMPORTANT NOTE: this container to download and install the needed rpm packages is behind a proxy so I had to set http_proxy and https_proxy env variables. I forgot to unset them and the first try to manually run the ovirt.py script failed with message: File "/opt/my-envs/py36/lib/python3.6/site-packages/ovirtsdk4/__init__.py", line 695, in _get_sso_response curl.perform() pycurl.error: (56, 'Received HTTP code 503 from proxy after CONNECT') because the proxy configured to go to the internet was unable to reach the lan of oVirt manager/hosts.... Gianluca

For those who want to run ovirt playbooks/dynamic inventories in a full Python3 awx/tower environment without any issue, you should consider this important point (as ovirt playbooks need to run with a local connection and with specific venv): https://github.com/ansible/awx/issues/3267 "(...) make sure any host with |ansible_connection: local| /also/ specifies |ansible_python_interpreter: '{{ ansible_playbook_python }}'|." my awx local inventory looks like this: --- ansible_ssh_user: root ansible_python_interpreter: '{{ ansible_playbook_python }}' Without this, awx will run playbook with the local (default OS one) python binary instead of the venv one that must contain the nss/openssl re-compiled pycurl. If you aim to use awx-rpm (https://awx.wiki/installation) * only el7 RPMs with default local py27, so consider the precedent point * create venv in the default venv path /opt/rh/rh-python36/root/usr/bin/awx-create-venv -n py36 * compile pycurl with nss support : yum install -y make gcc redhat-rpm-config python3-devel libcurl-devel libxml2-devel openssl-devel exportPYCURL_SSL_LIBRARY=nss;pip install pycurl --compile --no-cache-dir * Install ovirtsdk4 dependencies: pip install ansible ovirt-engine-sdk-python psutil * venv become available into templates/inventory table If you aim to use regular awx with el8 containers (https://github.com/ansible/awx/blob/devel/INSTALL.md#Docker-Compose) : * local python is already 3.6, so no issue with before * before launching installer: sed -i '/project_data_dir/c\project_data_dir=/var/lib/awx/projects'installer/inventory sed -i '/custom_venv_dir/c\custom_venv_dir=/opt/my-envs'installer/inventory * create a venv into the awx_container docker exec-it awx_web bash yum install -y make gcc redhat-rpm-config python3-devel libcurl-devel libxml2-devel openssl-devel python3 -m venv /opt/my-envs/py36 * compile pycurl with openssl support : source/opt/my-envs/py36/bin/activate exportPYCURL_SSL_LIBRARY=openssl;pip install pycurl --compile --no-cache-dir * Install ovirtsdk4 dependencies: pip install ansible ovirt-engine-sdk-python psutil * So as to get venv droplist availaible into templates/inventory tab settings -> system -> custom environment paths -> /opt/my-envs and login/logout. Le 03/12/2019 à 04:07, Guillaume Pavese a écrit :
My problem was that I did not fully follow your directions, and had not pip installed ovirt-engine-sdk-python in the virtualenv. Inventory is syncing now in awx.
Thanks for the help!
Guillaume Pavese IngénieurSystèmeet Réseau Interactiv-Group
On Fri, Nov 29, 2019 at 8:07 PM Nathanaël Blanchet <blanchet@abes.fr <mailto:blanchet@abes.fr>> wrote:
try if you can get a result with plain ovirt4.py execution:
cd /tmp
rsync -av /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py .
cat ovirt.ini [ovirt] ovirt_url = https://engine_fqdn/ovirt-engine/api ovirt_username = admin@internal ovirt_password = passwd
./ovirt4.py
Le 29/11/2019 à 09:57, Guillaume Pavese a écrit :
Hi,
I use awx rpm from awx.wiki and followed your directions to create a python2 venv with ansible 2.9.1 and built pycurl with nss, however syncing the inventory still fails :
stderr: ansible-inventory 2.9.1 config file = None configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible executable location = /var/lib/awx/venv/ovirt-p2/bin/ansible-inventory python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] No config file found; using defaults setting up inventory plugins [WARNING]: * Failed to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error:
File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/inventory/manager.py", line 280, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/var/lib/awx/venv/ovirt-p2/lib/python2.7/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e))
[WARNING]: Unable to parse /opt/rh/rh-python36/root/usr/lib/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source
Guillaume Pavese IngénieurSystèmeet Réseau Interactiv-Group
On Fri, Nov 29, 2019 at 4:51 AM Nathanaël Blanchet <blanchet@abes.fr <mailto:blanchet@abes.fr>> wrote:
give a try to https://awx.wiki/ based on rpms and not docker if you want to test this feature, it rocks.
------------------------------------------------------------------------ *De: *"Gianluca Cecchi" <gianluca.cecchi@gmail.com <mailto:gianluca.cecchi@gmail.com>> *À: *"Nathanaël Blanchet" <blanchet@abes.fr <mailto:blanchet@abes.fr>> *Cc: *"users" <users@ovirt.org <mailto:users@ovirt.org>> *Envoyé: *Jeudi 28 Novembre 2019 19:17:12 *Objet: *Re: [ovirt-users] AWX and error using ovirt as an inventory source
On Thu, Nov 28, 2019 at 5:33 PM Nathanaël Blanchet <blanchet@abes.fr <mailto:blanchet@abes.fr>> wrote:
Le 28/11/2019 à 17:15, Gianluca Cecchi a écrit :
On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@abes.fr <mailto:blanchet@abes.fr>> wrote:
Hello gianluca,
I reported this issue a long time ago (march of 19) in an unofficial rpm awx project
https://github.com/MrMEEE/awx-build/issues/72
But I see that it is marked as closed....
It's marked as closed for the unofficial RPM project only, not with the regular container deployment.
All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt* ansible module) fail because of the version of pycurl (worked before 7.19)
You mean inside awx container, correct? See below my comments, as I know almost nothing about venv concepts... sorry
What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this:
* # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt
I have to run this inside awx container as user root? Can you explain the syntax? I get error because of the parenthesis...
sure inside the container, parenthesis are the default parameters so you can use an other path:
/opt/rh/rh-python36/root/usr/bin/awx-create-venv -n ovirt -p 2
In my awx container I don't have /opt/rh/rh-python36/root/usr/bin/awx-create-venv and don't have awx-create-venv at all in any path. Not in container based on image ansible/awx_task:9.0.1 nor in container based on image ansible/awx_web:9.0.1
Gianluca
_______________________________________________ Users mailing list -- users@ovirt.org <mailto:users@ovirt.org> To unsubscribe send an email to users-leave@ovirt.org <mailto:users-leave@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/4MSEW7LVC4QOTA...
Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. IT, ES, UK. <https://interactiv-group.com/disclaimer.html>
-- Nathanaël Blanchet
Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr <mailto:blanchet@abes.fr>
Ce message et toutes les pièces jointes (ci-après le “message”) sont établis à l’intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le détruire et d’en avertir immédiatement l’expéditeur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L’internet ne permettant pas d’assurer l’intégrité de ce message . Interactiv-group (et ses filiales) décline(nt) toute responsabilité au titre de ce message, dans l’hypothèse ou il aurait été modifié. IT, ES, UK. <https://interactiv-group.com/disclaimer.html>
-- Nathanaël Blanchet Supervision réseau SIRE 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On Thu, Nov 28, 2019 at 8:50 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
give a try to https://awx.wiki/ based on rpms and not docker if you want to test this feature, it rocks.
Thanks for the input. Interesting. I would like to still try a little with containers though. It seems I'm a bit closer. I used your inputs and what in documentation: https://docs.ansible.com/ansible-tower/latest/html/upgrade-migration-guide/v... And these below were my steps. In repo sync I now get an error of type: " File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 101, in build_env for version in os.listdir(venv_libdir): FileNotFoundError: [Errno 2] No such file or directory: '/opt/my-envs/ovirt/lib' " possibly I have to add something else to this virtualenv? My steps inside awx container: 1) create directory structure for new custom virtual envs bash-4.4# mkdir -p /opt/my-envs bash-4.4# chmod 0755 /opt/my-envs 2) Configure new custom virtual env path $ curl -k -X PATCH 'https://my_user:my_pwd@my_awx_domain/api/v2/settings/system/' -d '{"CUSTOM_VENV_PATHS": ["/opt/my-envs/"]}' -H 'Content-Type:application/json' {"ACTIVITY_STREAM_ENABLED":true,"ACTIVITY_STREAM_ENABLED_FOR_INVENTORY_SYNC":false,"ORG_ADMINS_CAN_SEE_ALL_USERS":true,"MANAGE_ORGANIZATION_AUTH":true,"TOWER_URL_BASE":" https://towerhost ","REMOTE_HOST_HEADERS":["REMOTE_ADDR","REMOTE_HOST"],"PROXY_IP_WHITELIST":[],"LICENSE":{},"REDHAT_USERNAME":"","REDHAT_PASSWORD":"","AUTOMATION_ANALYTICS_URL":" https://example.com ","INSTALL_UUID":"63ee73ee-6346-4bce-b343-e03095238e35","CUSTOM_VENV_PATHS":["/opt/my-envs"],"INSIGHTS_TRACKING_STATE":false,"BROKER_DURABILITY":true} 3) create ovirt virtual env with python2 type bash-4.4# virtualenv /opt/my-envs/ovirt -p python2 Running virtualenv with interpreter /usr/bin/python2 Already using interpreter /usr/bin/python2 No LICENSE.txt / LICENSE found in source New python executable in /opt/my-envs/ovirt/bin/python2 Also creating executable in /opt/my-envs/ovirt/bin/python Installing setuptools, pip, wheel... done. bash-4.4# 4) install packages in container to be able to pip install psutil yum install gcc redhat-rpm-config python2-devel 5) pip install psutil bash-4.4# /opt/my-envs/ovirt/bin/pip install psutil DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Collecting psutil Using cached https://files.pythonhosted.org/packages/73/93/4f8213fbe66fc20cb904f35e6e04e2... Building wheels for collected packages: psutil Building wheel for psutil (setup.py) ... done Created wheel for psutil: filename=psutil-5.6.7-cp27-cp27mu-linux_x86_64.whl size=274582 sha256=bad7ce395c12db2dce3df34ebaf44de8db3137f73363f70743e413c699f23fbe Stored in directory: /home/awx/.cache/pip/wheels/52/41/b0/bf50409fe2b1d3b79afa3eed71b54b3e30fe5b695db2c7ba2e Successfully built psutil Installing collected packages: psutil Successfully installed psutil-5.6.7 bash-4.4# 6) install libcurl-devel in container as it is needed by the pycurl install next step (curl-config program) yum install libcurl-devel 7) pip install pycurl with nss bash-4.4# source /opt/my-envs/ovirt/bin/activate (ovirt) bash-4.4# export PYCURL_SSL_LIBRARY=nss; pip install pycurl --compile --no-cache-dir DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Collecting pycurl Downloading https://files.pythonhosted.org/packages/ac/b3/0f3979633b7890bab6098d84c84467... (215kB) |████████████████████████████████| 215kB 359kB/s Building wheels for collected packages: pycurl Building wheel for pycurl (setup.py) ... done Created wheel for pycurl: filename=pycurl-7.43.0.3-cp27-cp27mu-linux_x86_64.whl size=282624 sha256=a0e86e85d3ccb614a5b4df9d228797ec48749b395090207281d5525b2b521cc0 Stored in directory: /tmp/pip-ephem-wheel-cache-cidPtO/wheels/89/40/f5/7b4f2285aca871b5173887a6c69127210d92806c0d3a977e51 Successfully built pycurl Installing collected packages: pycurl Successfully installed pycurl-7.43.0.3 (ovirt) bash-4.4# 8) pip install ansible and python-memached (ovirt) bash-4.4# pip install ansible python-memcached DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Processing ./.cache/pip/wheels/5b/77/78/7b71e95b6489fb4d5bda764e40798cf379fba3228f576bb1ad/ansible-2.9.1-cp27-none-any.whl Collecting python-memcached Using cached https://files.pythonhosted.org/packages/f5/90/19d3908048f70c120ec66a39e61b92... Processing ./.cache/pip/wheels/d9/45/dd/65f0b38450c47cf7e5312883deb97d065e030c5cca0a365030/PyYAML-5.1.2-cp27-cp27mu-linux_x86_64.whl Collecting jinja2 Using cached https://files.pythonhosted.org/packages/65/e0/eb35e762802015cab1ccee04e8a277... Collecting cryptography Using cached https://files.pythonhosted.org/packages/c8/52/ad7f2cbe3b6e9340526dc401b38bb6... Requirement already satisfied: six>=1.4.0 in /opt/my-envs/ovirt/lib/python2.7/site-packages (from python-memcached) (1.13.0) Collecting MarkupSafe>=0.23 Using cached https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb... Requirement already satisfied: enum34; python_version < "3" in /opt/my-envs/ovirt/lib/python2.7/site-packages (from cryptography->ansible) (1.1.6) Collecting cffi!=1.11.3,>=1.8 Using cached https://files.pythonhosted.org/packages/93/5d/c4f950891251e478929036ca07b22f... Collecting ipaddress; python_version < "3" Using cached https://files.pythonhosted.org/packages/c2/f8/49697181b1651d8347d24c095ce46c... Processing ./.cache/pip/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511/pycparser-2.19-py2.py3-none-any.whl Installing collected packages: PyYAML, MarkupSafe, jinja2, pycparser, cffi, ipaddress, cryptography, ansible, python-memcached Successfully installed MarkupSafe-1.1.1 PyYAML-5.1.2 ansible-2.9.1 cffi-1.13.2 cryptography-2.8 ipaddress-1.0.23 jinja2-2.10.3 pycparser-2.19 python-memcached-1.59 (ovirt) bash-4.4# 9) Install libxml2-devel as a prerequisite for pip install ovirt-engine-sdk-python yum install libxml2-devel 10) pip install ovirt-engine-sdk-python (ovirt) bash-4.4# pip install ovirt-engine-sdk-python DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Collecting ovirt-engine-sdk-python Using cached https://files.pythonhosted.org/packages/28/eb/6ccef9afd320f7e0657af3b03e2c4a... Requirement already satisfied: pycurl>=7.19.0 in /opt/my-envs/ovirt/lib/python2.7/site-packages (from ovirt-engine-sdk-python) (7.43.0.3) Requirement already satisfied: six in /opt/my-envs/ovirt/lib/python2.7/site-packages (from ovirt-engine-sdk-python) (1.13.0) Requirement already satisfied: enum34 in /opt/my-envs/ovirt/lib/python2.7/site-packages (from ovirt-engine-sdk-python) (1.1.6) Building wheels for collected packages: ovirt-engine-sdk-python Building wheel for ovirt-engine-sdk-python (setup.py) ... done Created wheel for ovirt-engine-sdk-python: filename=ovirt_engine_sdk_python-4.3.3-cp27-cp27mu-linux_x86_64.whl size=297779 sha256=6137a18a3a91c70c29a104510b0bdc63c51564fd3dc72fb9a6327f150468ae34 Stored in directory: /home/awx/.cache/pip/wheels/a6/46/f1/701aa3e4fd90607107d61d3f065c67853976e3df2356c97cd1 Successfully built ovirt-engine-sdk-python Installing collected packages: ovirt-engine-sdk-python Successfully installed ovirt-engine-sdk-python-4.3.3 (ovirt) bash-4.4# 11) now I see drop down for virtualenvs inside awx gui to choose, as you suggested 12) I reconfigure my source to use new virtual env ovirt and then I try to sync I get this: 2.352 INFO Updating inventory 4: MYDC_OVIRT 2.825 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py Traceback (most recent call last): File "/var/lib/awx/venv/awx/bin/awx-manage", line 11, in <module> load_entry_point('awx==9.0.1.0', 'console_scripts', 'awx-manage')() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/__init__.py", line 158, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1153, in handle raise exc File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1043, in handle venv_path=venv_path, verbosity=self.verbosity).load() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 214, in load return self.command_to_json(base_args + ['--list']) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 182, in command_to_json env = self.build_env() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 101, in build_env for version in os.listdir(venv_libdir): FileNotFoundError: [Errno 2] No such file or directory: '/opt/my-envs/ovirt/lib' But I have this: bash-4.4# ls -l /opt/my-envs/ovirt/ total 4 drwxr-xr-x 2 root root 4096 Nov 30 11:20 bin drwxr-xr-x 2 root root 23 Nov 30 10:56 include drwxr-xr-x 3 root root 23 Nov 30 10:56 lib lrwxrwxrwx 1 root root 3 Nov 30 10:56 lib64 -> lib drwxr-xr-x 3 root root 17 Nov 30 11:07 share bash-4.4# ls -l /opt/my-envs/ovirt/lib total 4 drwxr-xr-x 4 root root 4096 Nov 30 10:56 python2.7 bash-4.4# What I'm missing in your opinion? Thanks in advance, Gianluca

Le 28/11/2019 à 16:59, Nathanaël Blanchet a écrit :
Hello gianluca,
I reported this issue a long time ago (march of 19) in an unofficial rpm awx project
https://github.com/MrMEEE/awx-build/issues/72
All related RHV/ovirt stuff (not only dynamic inventory, but all ovirt* ansible module) fail because of the version of pycurl (worked before 7.19)
What you need to do is create a py2.x venv then recompile latest pycurl with nss support like this:
* # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt
I forgot to precise python2 (some ovirt ansible module fail with py3) # /opt/rh/rh-python36/root/usr/bin/awx-create-venv (-e /var/lib/awx/venv/) -n ovirt -p 2
* source /var/lib/awx/venv/ovirt/bin/activate * # (ovirt) export PYCURL_SSL_LIBRARY=nss; pip install pycurl --compile --no-cache-dir
* # (ovirt) pip install ovirt-engine-sdk-python ansible psutil python-memcached
* choose this venv instead of the regular in your inventory page and you'll be able to sync
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 forlabelinlabels], ## ajout NBT pour obtenir le nom de l'hote a la place de l ip 'ansible_host': vm.name, 'affinity_groups': [
Le 28/11/2019 à 15:51, Gianluca Cecchi a écrit :
Hello, I have awx 9.0.1 and ansible 2.8.5 in container of a CentOS 7.7 server. I'm trying to use oVirt 4.3.6.7-1.el7 as a source of an inventory in awx but I get error when syncing
Find at bottom below the error messages. I see that in recent past (around June this year) there were some problems, but they should be solved now, correct? There was also a problem in syncing when some powered off VMs were present in oVirt env, but I think this solved too, correct?
Any way to replicate / test from command line of awx container? I try some things but in command line I always get error regarding
oVirt inventory script requires ovirt-engine-sdk-python >= 4.0.0
that I think depends on not using correct command line and/or not setting needed env.
Thanks in advance, Gianluca
2.536 INFO Updating inventory 4: MYDC_OVIRT 3.011 INFO Reading Ansible inventory source: /var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/plugins/inventory/ovirt4.py 3.013 INFO Using VIRTUAL_ENV: /var/lib/awx/venv/ansible 3.013 INFO Using PATH: /var/lib/awx/venv/ansible/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/var/lib/awx/venv/awx/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 3.013 INFO Using PYTHONPATH: /var/lib/awx/venv/ansible/lib/python3.6/site-packages: Traceback (most recent call last): File "/var/lib/awx/venv/awx/bin/awx-manage", line 11, in <module> load_entry_point('awx==9.0.1.0', 'console_scripts', 'awx-manage')() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/__init__.py", line 158, in manage execute_from_command_line(sys.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1153, in handle raise exc File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 1043, in handle venv_path=venv_path, verbosity=self.verbosity).load() File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 214, in load return self.command_to_json(base_args + ['--list']) File "/var/lib/awx/venv/awx/lib64/python3.6/site-packages/awx/main/management/commands/inventory_import.py", line 197, in command_to_json self.method, proc.returncode, stdout, stderr)) RuntimeError: ansible-inventory failed (rc=1) with stdout: stderr: ansible-inventory 2.8.5 config file = /etc/ansible/ansible.cfg configured module search path = ['/var/lib/awx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible-inventory python version = 3.6.8 (default, Oct 7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] Using /etc/ansible/ansible.cfg as config file [WARNING]: * Failed to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py with script plugin: Inventory script (/var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py) had an execution error:
File "/usr/lib/python3.6/site-packages/ansible/inventory/manager.py", line 268, in parse_source plugin.parse(self._inventory, self._loader, source, cache=cache) File "/usr/lib/python3.6/site-packages/ansible/plugins/inventory/script.py", line 161, in parse raise AnsibleParserError(to_native(e))
[WARNING]: Unable to parse /var/lib/awx/venv/awx/lib64/python3.6/site- packages/awx/plugins/inventory/ovirt4.py as an inventory source
ERROR! No inventory was parsed, please check your configuration and options.
_______________________________________________ Users mailing list --users@ovirt.org To unsubscribe send an email tousers-leave@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/DGTCAAC5DZHSKG... -- Nathanaël Blanchet
Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@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/AZTRIDK4UX6C2T...
-- Nathanaël Blanchet Supervision réseau Pôle Infrastrutures Informatiques 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr

On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@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

On Wed, Dec 18, 2019 at 5:21 PM Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@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
In the mean time I opened an issue in awx: https://github.com/ansible/awx/issues/5539 Gianluca

Hello Ondra what do you think about this question? ovirt4.py may need some modifications to get required IPs/hostnames when multiple vm has multiple interfaces ? Personalized hack works for me but I have to modify the file each time I upgrade AWX. De: "Gianluca Cecchi" <gianluca.cecchi@gmail.com> À: "Nathanaël Blanchet" <blanchet@abes.fr> Cc: "users" <users@ovirt.org> Envoyé: Mercredi 18 Décembre 2019 17:21:40 Objet: Re: [ovirt-users] AWX and error using ovirt as an inventory source On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet < [ mailto:blanchet@abes.fr | blanchet@abes.fr ] > wrote: Hello gianluca, [snip] BQ_BEGIN 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' : [ [ http://label.name/ | label.name ] for label in labels], ## ajout NBT pour obtenir le nom de l'hote a la place de l ip 'ansible_host' : [ http://vm.name/ | vm.name ] , 'affinity_groups' : [ BQ_END Hello, coming back to this PS of yours. in my case [ http://vm.name/ | 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': [ http://vm.id/ | vm.id ] , 'name': [ http://vm.name/ | vm.name ] , ... 'devices': dict( ( [ http://device.name/ | 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': [ http://vm.id/ | vm.id ] , 'name': [ http://vm.name/ | vm.name ] , ... 'devices': dict( ( [ http://device.name/ | 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

On Wed, Dec 18, 2019 at 7:28 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello Ondra what do you think about this question? ovirt4.py may need some modifications to get required IPs/hostnames when multiple vm has multiple interfaces ? Personalized hack works for me but I have to modify the file each time I upgrade AWX. ------------------------------ *De: *"Gianluca Cecchi" <gianluca.cecchi@gmail.com> *À: *"Nathanaël Blanchet" <blanchet@abes.fr> *Cc: *"users" <users@ovirt.org> *Envoyé: *Mercredi 18 Décembre 2019 17:21:40 *Objet: *Re: [ovirt-users] AWX and error using ovirt as an inventory source
On Thu, Nov 28, 2019 at 4:59 PM Nathanaël Blanchet <blanchet@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
Any feedback on this and why the sync of the inventory from the GUI doesn't update the ansible_host variable? Nathanaël, can you try, if you have a dev environment, to change the ansible_host to another value and see if it is picked up or not? In the mean time I see that in my bug entry for awx the status has been put to need_info, but I don't know why and I have asked more info about it.... Gianluca

On Tue, Jan 7, 2020 at 4:42 PM Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
On Wed, Dec 18, 2019 at 7:28 PM Nathanaël Blanchet <blanchet@abes.fr> wrote:
Hello Ondra what do you think about this question? ovirt4.py may need some modifications to get required IPs/hostnames when multiple vm has multiple interfaces ? Personalized hack works for me but I have to modify the file each time I upgrade AWX. ------------------------------
[snip]
Any feedback on this and why the sync of the inventory from the GUI doesn't
update the ansible_host variable? Nathanaël, can you try, if you have a dev environment, to change the ansible_host to another value and see if it is picked up or not? In the mean time I see that in my bug entry for awx the status has been put to need_info, but I don't know why and I have asked more info about it....
Gianluca
I think I have found the culprit: during source inventory sync it is the ovirt4.py of awx_task container that is executed and not the ovirt4.py of awx_web container. In fact creating a new inventory based on another RHV environment I got the same problem related to ansible_host variable value. As soon as I modify instead the /var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/plugins/inventory/ovirt4.py on awx_task container I both get correct values (vm.fqdn) for new created inventories and when updating existing ones. Gianluca
participants (3)
-
Gianluca Cecchi
-
Guillaume Pavese
-
Nathanaël Blanchet