Closed dc-chris-smith closed 1 year ago
I think I ran into this as well using an older version of python3. See https://community.infoblox.com/t5/api-integration-devops-netops/issues-with-infoblox-client-in-ansible/td-p/16300.
Thanks for the link @fostermi. I executed a bash shell on the execution environment container on one of the execution nodes and I see the client and all dependencies there. I even executed an example from the infoblox-client repo and it worked with no problems. It appears to have trouble working when run from a template defined on the controller.
bash-4.4# pip show infoblox-client
Name: infoblox-client
Version: 0.6.0
Summary: Client for interacting with Infoblox NIOS over WAPI
Home-page: https://github.com/infobloxopen/infoblox-client
Author: John Belamaric
Author-email: jbelamaric@infoblox.com
License: Apache
Location: /usr/lib/python3.8/site-packages
Requires: oslo.log, oslo.serialization, requests, setuptools, six, urllib3
Required-by:
bash-4.4#
bash-4.4# python3
Python 3.8.13 (default, Jun 24 2022, 15:27:57)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-13)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from infoblox_client import connector
opts = {'host': '0.0.0.0', 'username': 'xxxxxxxxxx', 'password': '*****************'}
conn = connector.Connector(opts)
network = conn.get_object('network', {'network': '0.0.0.0/24', 'network_view': 'default'})
network
[{'_ref': 'network/XXxxxXXxxxXXXxxxXxxxxxXxXXX:0.0.0.0/24/default', 'network': '0.0.0.0/24', 'network_view': 'default'}]
The Ansible information you posted on your original request says /usr/local/lib/python3.9
, however your test on your last post says /usr/lib/python3.8
. Go back to that bash and run ansible --version
, see if they're pointing to the same Python location.
The first post information is from the Ansible execution node. The later test is from the Execution Environment that Ansible uses to run the job. The job is run in the context of the EE container, not the host itself.
I used a RHEL desktop with Ansible core, Python3.9, the infoblox-client and all the required modules installed. When I run a job there to add an A record in Infoblox, it works fine. The job parameters are the same as they are on the Ansible Automation Platform where it fails with the message that the client is not installed. Does anyone have any idea why this won't run from an execution environment in AAP?
No joy there. I even created a brand new container that only has little more than the infoblox-client installed in it. I still get the same error. I don't know where platform-python is coming from in the error either. The default python in any of these containers is python3.9. My containers are based on ubuntu-latest, could that be where the issue is?
I'm able to use the infoblox modules in an Ubuntu container created from a custom Docker image.
root@3816cf105c2e:/work# python3 --version
Python 3.8.10
root@3816cf105c2e:/work# pip list | grep infoblox-client
infoblox-client 0.5.2
I see the same with these EE containers. I can run commands within the container, and they work. It is only when I execute a template on the AAP controller that I get this error. I did notice that your client is at version 0.5.2 where mine is 0.6.0.
Try setting ansible_python_interpreter
in your playbook and see if that helps. I have has some issues like this before when working in python virtual environments.
Here's and example you can dump straight into your playbook.
vars:
ansible_python_interpreter: "{{ ansible_playbook_python }}"
Thanks @matthewdennett! I received that same advice from Red Hat as well.
Just so that anyone else who runs into this and finds this issue later, I did not have to change the interpreter if I used ansible-playbook to run the job with a base install of Ansible via the command line. When running it with an Execution Environment in Ansible Automation Platform 2.x, the problem appears.
The fix is to add the python interpreter path to the playbook variables. To ensure you get the correct interpreter, run the following inside the EE container:
bash-4.4# which python3
/usr/bin/python3
Then add the following line to the variables section in the AAP Template definition (using auto
or auto-legacy
as the setting did not work):
ansible_python_interpreter: /usr/bin/python3
I am testing in my lab and recently upgraded our Ansible Automation Platform there to version 2.3. I have included the infoblox-client, the dependencies it requires, and infoblox.nios_modules in one of my EEs and I still get this message. Any help will be greatly appreciated. If more information is needed, I will provide what I am allowed to.
-- Ansible Automation Platform Controller version 4.3.1
Ansible version info
EE build info
requirements.txt (I have had infoblox-client here as well as in the EE yaml file where it is now)
execution-environment.yml
requirements.yml