On Fri, Dec 13, 2019 at 11:50 PM Nathanaël Blanchet <blanchet(a)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