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.cec...@gmail.com> 
À: "Guillaume Pavese" <guillaume.pav...@interactiv-group.com> 
Cc: "Nathanaël Blanchet" <blanc...@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? 

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

Reply via email to