awx
awx copied to clipboard
AWX Execution environment is not able to read the Python dependency library installed during runtime using pip
Please confirm the following
- [X] I agree to follow this project's code of conduct.
- [X] I have checked the current issues for duplicates.
- [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.
- [X] I am NOT reporting a (potential) security vulnerability. (These should be emailed to
[email protected]instead.)
Bug Summary
I am trying to install a dependency library during runtime, but EE is not able to detect the package.
Here in this example ansible.utils.ipaddr filter requires python library netaddr
Execution Environment Name
AWX EE (latest) - quay.io/ansible/awx-ee:latest
Playbook
---
- name: IP Validator
hosts: localhost
gather_facts: false
tasks:
- name: Install netaddr Package
ansible.builtin.pip:
name: netaddr
- name: Validate IP
ansible.builtin.debug:
msg: "{{ '192.168.0.0' | ansible.utils.ipaddr }}"
Task 1 Output
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /runner/.ansible/tmp/ansible-tmp-1711885673.001096-22-101960726803207/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
"changed": true,
"cmd": [
"/usr/bin/python3",
"-m",
"pip.__main__",
"install",
"netaddr"
],
"invocation": {
"module_args": {
"chdir": null,
"editable": false,
"executable": null,
"extra_args": null,
"name": [
"netaddr"
],
"requirements": null,
"state": "present",
"umask": null,
"version": null,
"virtualenv": null,
"virtualenv_command": "virtualenv",
"virtualenv_python": null,
"virtualenv_site_packages": false
}
Task2 Output
TASK [Validate IP] *************************************************************
task path: /runner/project/02_ntc_parser.yml:11
fatal: [localhost]: FAILED! => {
"msg": "Failed to import the required Python library (netaddr) on automation-job-331-89tqd's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"
}
PLAY RECAP *********************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Any help to resolve this issue is appreciated
AWX version
AWX 23.8.1
Select the relevant components
- [X] UI
- [ ] UI (tech preview)
- [ ] API
- [ ] Docs
- [ ] Collection
- [ ] CLI
- [X] Other
Installation method
minikube
Modifications
no
Ansible version
No response
Operating system
No response
Web browser
No response
Steps to reproduce
Use any default EE
Eg
AWX EE (latest) - quay.io/ansible/awx-ee:latest
Run below Playbook
---
- name: IP Validator
hosts: localhost
gather_facts: false
tasks:
- name: Install netaddr Package
ansible.builtin.pip:
name: netaddr
- name: Validate IP
ansible.builtin.debug:
msg: "{{ '192.168.0.0' | ansible.utils.ipaddr }}"
### Expected results
It should detect installed library and run the `ansible.utils.ipaddr` filter
### Actual results
```bash
TASK [Validate IP] *************************************************************
task path: /runner/project/02_ntc_parser.yml:11
fatal: [localhost]: FAILED! => {
"msg": "Failed to import the required Python library (netaddr) on automation-job-331-89tqd's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"
}
PLAY RECAP *********************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Additional information
No response
Can you open a thread around this on forum.ansible.com?