Having issue with BigIP F5 modules

Hi,

I’m currently experiencing issue on BigIP F5 modules. My playboooks do not run on AWX environment but work CLI mode.
Here is an output of the error:

{
“module_stdout”: “”,
“module_stderr”: “Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-tmp-1597390589.096363-1639-171265220184956/AnsiballZ_bigip_device_info.py", line 102, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-tmp-1597390589.096363-1639-171265220184956/AnsiballZ_bigip_device_info.py", line 94, in ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-tmp-1597390589.096363-1639-171265220184956/AnsiballZ_bigip_device_info.py", line 40, in invoke_module\n runpy.run_module(mod_name=‘ansible.modules.bigip_device_info’, init_globals=None, run_name=‘main’, alter_sys=True)\n File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\n return run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib64/python3.6/runpy.py", line 96, in run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File "/usr/lib64/python3.6/runpy.py", line 85, in run_code\n exec(code, run_globals)\n File "/tmp/ansible_bigip_device_info_payload_zhn5zq/ansible_bigip_device_info_payload.zip/ansible/modules/bigip_device_info.py", line 7232, in \n File "/tmp/ansible_bigip_device_info_payload_zhn5zq/ansible_bigip_device_info_payload.zip/ansible/module_utils/bigip.py", line 11, in \nImportError: cannot import name ‘F5BaseClient’\n”,
“exception”: “Traceback (most recent call last):\n File "/root/.ansible/tmp/ansible-tmp-1597390589.096363-1639-171265220184956/AnsiballZ_bigip_device_info.py", line 102, in \n _ansiballz_main()\n File "/root/.ansible/tmp/ansible-tmp-1597390589.096363-1639-171265220184956/AnsiballZ_bigip_device_info.py", line 94, in ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/root/.ansible/tmp/ansible-tmp-1597390589.096363-1639-171265220184956/AnsiballZ_bigip_device_info.py", line 40, in invoke_module\n runpy.run_module(mod_name=‘ansible.modules.bigip_device_info’, init_globals=None, run_name=‘main’, alter_sys=True)\n File "/usr/lib64/python3.6/runpy.py", line 205, in run_module\n return run_module_code(code, init_globals, run_name, mod_spec)\n File "/usr/lib64/python3.6/runpy.py", line 96, in run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File "/usr/lib64/python3.6/runpy.py", line 85, in run_code\n exec(code, run_globals)\n File "/tmp/ansible_bigip_device_info_payload_zhn5zq/ansible_bigip_device_info_payload.zip/ansible/modules/bigip_device_info.py", line 7232, in \n File "/tmp/ansible_bigip_device_info_payload_zhn5zq/ansible_bigip_device_info_payload.zip/ansible/module_utils/bigip.py", line 11, in \nImportError: cannot import name ‘F5BaseClient’\n”,
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,
“rc”: 1,
“_ansible_no_log”: false,
“changed”: false,
“_ansible_delegated_vars”: {
“ansible_host”: “localhost”
}
}

My running environment
AWX docker mode on RedHat 7.7

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ccb21bae3b58 ansible/awx:12.0.0 “tini – /usr/bin/la…” 7 weeks ago Up 2 days 8052/tcp awx_task
cf125891f3fc ansible/awx:12.0.0 “tini – /bin/sh -c …” 7 weeks ago Up 2 days 0.0.0.0:80->8052/tcp awx_web
f9f5383ca004 redis “docker-entrypoint.s…” 7 weeks ago Up 2 days 6379/tcp awx_redis
584a9fe5661f postgres:10 “docker-entrypoint.s…” 7 weeks ago Up 2 days 5432/tcp awx_postgres

ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Jun 11 2019, 15:15:01) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

Many thanks for your help.

Laurent

Looks like a python module import error. Did you install f5 python sdk?
If not, see if that helps. I’d go with new virtual environment setup, that would be used only for bigip related templates/projects.

Dana petak, 14. kolovoza 2020. u 09:49:07 UTC+2 korisnik lauren...@gmail.com napisao je:

https://docs.ansible.com/ansible-tower/latest/html/upgrade-migration-guide/virtualenv.html
This will guide you through virtual env setup. Once you have iit up and running, run pip install f5-sdk

Then in awx interface change the virtual environment to the new one on project or template basis.

Dana petak, 14. kolovoza 2020. u 14:09:06 UTC+2 korisnik Hrvoje Gašpar napisao je:

Many thanks for your feedback, really appreciate.
I did follow your reco on installing f5-sdk on a new fresh venv in awx-task container

I kept default location in /var/lib/awx/venv/

Here an output of pip package installed.

(LTM) bash-4.4# pip freeze
ansible==2.9.12
certifi==2020.6.20
cffi==1.14.2
chardet==3.0.4
cryptography==3.0
f5-icontrol-rest==1.3.13
f5-sdk==3.0.21
idna==2.10
Jinja2==2.11.2
MarkupSafe==1.1.1
pycparser==2.20
PyYAML==5.3.1
requests==2.24.0
six==1.15.0
urllib3==1.25.10

(LTM) bash-4.4# ansible localhost -m debug -a “var=ansible_playbook_python”
localhost | SUCCESS => {
“ansible_playbook_python”: “/var/lib/awx/venv/LTM/bin/python3.6”
}

But no effect on AWX playbook, which still fail, as I do not know where to find Virtual Environment list box to change environment.

Many thanks.
Laurent