0

Hopefully someone can provide guidance as to what I'm missing. I've created a new EE environment for use in an AWX 21.0.0 deployment. I'm going basic for now, but not having much luck. Here's the configs for the EE:

execution-environment.yml

---
version: 1
dependencies:
  galaxy: requirements.yml
  python: requirements.txt

requirements.yml

---
collections:
  - name: infoblox.nios_modules
  - name: f5networks.f5_modules

requirements.txt

infoblox-client
dnspython
pysnow
ijson
python-magic
pypsrp
urllib3

Everything appears to build fine. When I fire up the container to inspect, what I need for InfoBlox appears to be there:

[root@c772b7b80cfb ~]# pip3 list |grep infoblox
infoblox-client    0.5.0
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
[root@c772b7b80cfb ~]# ansible-galaxy collection list |grep infoblox
infoblox.nios_modules 1.3.0
[root@c772b7b80cfb ~]# ansible --version
ansible [core 2.12.5.post0]
  config file = None
  configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.13 (default, Jun 24 2022, 15:27:57) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
  jinja version = 2.11.3
  libyaml = True

I then have this basic playbook for testing that works fine in older AWX instances (pre-EE using collections folder in my repo and pip module to install infoblox-client):

---
- name: Print next available IP
  hosts: all
  gather_facts: false

  vars:
    infoblox_provider:
      host: '{{ lookup("env", "INFOBLOX_HOST") }}'
      username: '{{ lookup("env", "INFOBLOX_USERNAME") }}'
      password: '{{ lookup("env", "INFOBLOX_PASSWORD") }}'

  tasks:

    - set_fact:
        TEMP_VIP:  "{{ lookup('infoblox.nios_modules.nios_next_ip', '10.0.0.0/24') | first }}"
      delegate_to: localhost

    - debug: msg="{{ TEMP_VIP }}"

I ensure my credentials are created correctly and assigned to the template in AWX. I've created an inventory with 'localhost', assign that to the template and execute. Here is the error I receive:

PLAY [Print next available IP] *************************************************
TASK [set_fact] ****************************************************************
fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'infoblox.nios_modules.nios_next_ip'. Error was a <class 'Exception'>, original message: infoblox-client is required but does not appear to be installed.  It can be installed using the command `pip install infoblox-client`. infoblox-client is required but does not appear to be installed.  It can be installed using the command `pip install infoblox-client`"}
PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'infoblox.nios_modules.nios_next_ip'. Error was a <class 'Exception'>, original message: infoblox-client is required but does not appear to be installed. It can be installed using the command pip install infoblox-client. infoblox-client is required but does not appear to be installed. It can be installed using the command pip install infoblox-client"}


I understand there have been references to issues with 'implicit localhost connections', however specifying 'ansible_python_interpreter: "/usr/bin/python3"' under vars in the playbook has no affect. Neither did adding 'delegate_to' to the lookup task.

I imagine I'm missing something which should be obvious (or just perhaps better documented). Any guidance would be much appreciated!

Mike Pennington
  • 41,899
  • 19
  • 136
  • 174

1 Answers1

1

I figured out the issue if anyone comes across this post. Under requirements.txt I had urllib3 in the list of modules to install. It appears infoblox-client installs a version of urllib3 that it needs and putting another reference to urllib3 further down in the list overwrites the one needed by infoblox-client with another version. I removed the installed urllib3 and ran:

python3 -m pip install --upgrade infoblox-client

and it reinstalled the proper version. All is working now.