ansible / awx-ee

An Ansible execution environment for AWX project
https://quay.io/ansible/awx-ee
Other
129 stars 152 forks source link

python /bin/sh: line 1: /usr/bin/python: No such file or directory #168

Closed kumaresan078 closed 1 year ago

kumaresan078 commented 1 year ago

Hi All,

I recently encountered python issue while running my playbook on awx tower.While checking the python version from awx-ee container could see python3.9.

The issue similar to https://github.com/ansible/ansible/issues/77840 where the python issue occures on suse linux servers.

ansiadm@server1:~> python -V Python 2.7.18 ansiadm@server1:~> python3 -V Python 3.4.10 ansiadm@server:~>

{ "module_stdout": "", "module_stderr": "/bin/sh: line 1: /usr/bin/python: No such file or directory\n", "msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error", "rc": 127, "_ansible_no_log": null, "changed": false, "_ansible_delegated_vars": { "ansible_host": "localhost", "ansible_port": null, "ansible_user": "ansiadm", "ansible_connection": "local" } }

Regards Kumaresan

TheChef23 commented 1 year ago

I am are also seeing this issue.

fosterseth commented 1 year ago

@kumaresan078 can you provide the playbook (redact any sensitive info) that generated this error?

are you using a custom EE based on awx-ee:latest, or just awx-ee itself?

are you setting ansible_python_interpreter anywhere (e.g. ansible config, inventory, playbook)?

kumaresan078 commented 1 year ago

Hi Fosterseth,

Yes the below variable defined in template. As we use multiple flavor of linux the python interpreter not same on all servers.

ansible_python_interpreter: /usr/bin/python

The below error reported initially in the local_action module when using awx-ee:latest image

/bin/sh: line 1: /usr/bin/python: No such file or directory

- name: Empty file
  become: false
  local_action: file
     path=/tmp/test.csv
     state=absent
  run_once: yes

Then i remove the python_intrepeter variable post that below errors occurred on suse 12 servers.

{"ansible.legacy.setup": {"failed": true, "msg": "ansible-core requires a minimum of Python2 version 2.7 or Python3 version 3.5. Current version: 3.4.10 (default, Dec 13 2019, 16:20:47) [GCC]"}}, "msg": "The following modules failed to execute: ansible.legacy.setup\n"

Finally changed the awx-ee image to below version which fixed the issue.

quay.io/ansible/awx-ee:21.11.0

Regards Kumaresan