What is the right procedure to update ansible version in AWX running in the docker containers? What container to update? I’ve noticed that awx_task and awx_web containers both running ansible v2.7.9.
Do I have to update ansible in both containers?
This will get updated next time we make an AWX release, you can do it yourself by pulling it and updating them… you’ll need to point the installer at your new images wherever you host them.
Hi Matthew,
Unfortunately, there is no clear or safe way to upgrade from one AWX version to another and we stay on one version for about 6-12 month, and when we upgrade, we have to re-create everything manually. It takes time… At this moment I need new functionality from ansible 2.8.
So, I went ahead and updated ansible version in the awx_web container. Running tests now…
UPDATE: after the update, even the “About” dialog shows ansible v2.8.0, the job log starts with ansible-playbook 2.7.9.
…and if I update awx_task container it breaks everything.
I guess there is no easy way to update only ansible version without touching AWX itself…
Have you considered creating your own custom virtual environment?
This can be used for inventory updates or job execution, and does not effect what version of ansible awx uses for other tasks.
https://github.com/ansible/awx/blob/devel/docs/custom_virtualenvs.md
Hi Elijah,
No, I didn’t… that is a good idea I’ll try tomorrow.
Steps to follow awx_web and awx_task container to setup virtual env for ansible 2.X.X ( Replace 2.X.X with respective version number you want )
Getting errors running this command:
/var/lib/awx/venv/ansible_2.8.0/bin/pip install python-memcached psutil
Errors:
`
[root@awx venv]# /var/lib/awx/venv/ansible_2.8.0/bin/pip install python-memcached psutil
Collecting python-memcached
Using cached https://files.pythonhosted.org/packages/f5/90/19d3908048f70c120ec66a39e61b92c253e834e6e895cd104ce5e46cbe53/python_memcached-1.59-py2.py3-none-any.whl
Collecting psutil
Using cached https://files.pythonhosted.org/packages/c6/c1/beed5e4eaa1345901b595048fab1c85aee647ea0fc02d9e8bf9aceb81078/psutil-5.6.2.tar.gz
Collecting six>=1.4.0 (from python-memcached)
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Building wheels for collected packages: psutil
Building wheel for psutil (setup.py) … error
ERROR: Complete output from command /var/lib/awx/venv/ansible_2.8.0/bin/python36 -u -c ‘import setuptools, tokenize;file=’“'”‘/tmp/pip-install-9go6kp2j/psutil/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ bdist_wheel -d /tmp/pip-wheel-ufytb431 --python-tag cp36:
ERROR: running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/psutil
copying psutil/init.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_common.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_compat.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_psaix.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_psbsd.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_pslinux.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_psosx.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_psposix.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_pssunos.py → build/lib.linux-x86_64-3.6/psutil
copying psutil/_pswindows.py → build/lib.linux-x86_64-3.6/psutil
creating build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/init.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/main.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/runner.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_aix.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_bsd.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_connections.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_contracts.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_linux.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_memory_leaks.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_misc.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_osx.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_posix.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_process.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_sunos.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_system.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_unicode.py → build/lib.linux-x86_64-3.6/psutil/tests
copying psutil/tests/test_windows.py → build/lib.linux-x86_64-3.6/psutil/tests
running build_ext
building ‘psutil._psutil_linux’ extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/psutil
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=562 -DPSUTIL_LINUX=1 -I/usr/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command ‘gcc’ failed with exit status 1
Larry,
psutil/_psutil_common.c:9:20: fatal error: Python.h: No such file or directory
You’re missing the libraries and header files needed to build psutil. You probably want something like (depending on your OS/distribution):
~ yum search python36-dev
python36-devel.x86_64 : Libraries and header files needed for Python development <-----
Have you make sure that these packages are installed correctly on both containers?
yum install gcc python-devel
`
Package gcc-4.8.5-36.el7_6.2.x86_64 already installed and latest version
Package python-devel-2.7.5-77.el7_6.x86_64 already installed and latest version
`
python version is 2.7.5… should I have python 3???
Yes please . Kindly follow what Ryan had mentioned
Here is what I’m getting when running yum search python36-dev:
`
[root@awx venv]# yum search python36-dev
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
-
base: mirror.es.its.nyu.edu
-
epel: mirror.steadfastnet.com
-
extras: mirror.es.its.nyu.edu
-
updates: mirror.fileplanet.com
================================================================================== N/S matched: python36-dev ===================================================================================
boost-python36-devel.x86_64 : Shared object symbolic links for Boost.Python 3
python36-devel.x86_64 : Libraries and header files needed for Python development
shiboken-python36-devel.x86_64 : Development files for shiboken
Name and summary matches only, use “search all” for everything.
`
How do I get these?
You need the libs/headers available to the whatever python interpreter you specified when you created /var/lib/awx/venv/ansible_2.8.0/
So if you used a yum installed python36, you need to yum install the python36-devel package for the python36 interpreter.
THANK YOU!!! I was missing “python36-devel.x86_64” in both containers.
So, now everything is installed including ansible 2.8.0. Is there anything special I have to do in order to use a new module from 2.8.0 version? For example, I need to run “vmware_export_ovf” module. Sure I’ve tried:
`
ansible-playbook 2.7.9
2
config file = /etc/ansible/ansible.cfg
3
configured module search path = [u’/var/lib/awx/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
4
ansible python module location = /usr/lib/python2.7/site-packages/ansible
5
executable location = /usr/bin/ansible-playbook
6
python version = 2.7.5 (default, Apr 9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
7
Using /etc/ansible/ansible.cfg as config file
8
SSH password:
9
/tmp/awx_1520_u3wk2xic/tmpjbx7ym8_ did not meet host_list requirements, check plugin documentation if this is unexpected
10
Parsed /tmp/awx_1520_u3wk2xic/tmpjbx7ym8_ inventory source with script plugin
11
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
12
13
The error appears to have been in ‘/var/lib/awx/projects/vmMaintBackup/vmBackupDriver.yml’: line 11, column 5, but may
14
be elsewhere in the file depending on the exact syntax problem.
15
16
The offending line appears to be:
17
18
19
- name: Exporting data
20
^ here
21
`
Sujith,
Is there anything else I have to do to get AWX to see new virtual env? I have installed ansible_2.8.0, but still cannot run new module vmware_export_ovf
Regards,
Larry
Hi Larry,
You need to point the virtual environment either in job template or under the organization. Check this out :
Also, enable debug mode in job template then run and see whether it is calling the right version of Ansible
Regards,
Sujith
Thank you! After pointing to virtual env I had to install a couple more missing modules with pip. And it’s working now.
Thank you, everyone, for the help!
Regards,
Larry
Great to hear