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/virtualenv.html

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/4f8213fbe66fc20cb904f35e6e04e20b47b85bee39845cc66a0bcf5ccdcb/psutil-5.6.7.tar.gz
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/0f3979633b7890bab6098d84c84467030b807a1e2b31f5d30103af5a71ca/pycurl-7.43.0.3.tar.gz (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/19d3908048f70c120ec66a39e61b92c253e834e6e895cd104ce5e46cbe53/python_memcached-1.59-py2.py3-none-any.whl
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/eb35e762802015cab1ccee04e8a277b03f1d8e53da3ec3106882ec42558b/Jinja2-2.10.3-py2.py3-none-any.whl
Collecting cryptography
  Using cached https://files.pythonhosted.org/packages/c8/52/ad7f2cbe3b6e9340526dc401b38bb67c06160449446e15b0bf5f947fa168/cryptography-2.8-cp27-cp27mu-manylinux2010_x86_64.whl
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/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
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/c4f950891251e478929036ca07b22f0b10324460c1d0a4434c584481db51/cffi-1.13.2-cp27-cp27mu-manylinux1_x86_64.whl
Collecting ipaddress; python_version < "3"
  Using cached https://files.pythonhosted.org/packages/c2/f8/49697181b1651d8347d24c095ce46c7346c37335ddc7d255833e7cde674d/ipaddress-1.0.23-py2.py3-none-any.whl
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/6ccef9afd320f7e0657af3b03e2c4a18bb12ad3e00c655d6794f46e42c9f/ovirt-engine-sdk-python-4.3.3.tar.gz
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