Python Script is not running on the specified Execution Environement

Posted on

I have an Ansible Playbook which has a task to run a python script. The code for the task is as follows:

tasks:
- name: run a python script
command: python3 /home/pythonfiles/endec.py {{ operation }} {{ str }} {{ passwd }}
register: result

The python script imports a package called "Cryptocode" which I have installed on an Execution Environment Container image that is stored on quay.io and is accessed using the Automation Platform.

When I run the playbook with the Execution Environment that has the python package installed (I checked using podman run imagename pip3 list command which does list the cryptocode package I've mentioned), an error is thrown saying that
"import cryptocode","ModuleNotFoundError: No module named 'cryptocode'"

However, when I pip3 install cryptocode on the execution node that runs the playbook no errors are shown.

I have attached the playbook as well as the python script with this discussion.

Is there a reason why the python script is not being run inside the Execution Environment (Container Image)?
Could someone please help me fix this issue?
Thank you in advance!

Attachments

Responses