TASK [Running script on host] **************************************************
fatal: [hostnamehere.whatever.com]: FAILED! => {"changed": true, "failed": true, "rc": 127, "stderr": "", "stdout": "/usr/bin/env: No such file or directory\r\n", "stdout_lines": ["/usr/bin/env: No such file or directory"]}
So basically, no such file or directory? I'm assuming the "/usr/bin/env" is from the first line of the Python script:
#!/usr/bin/env python
Which, from my understanding is supposed to make sure to use whatever Python is applicable as Python can be installed in different paths. If Ansible can't find it, what can I do?
When I do an echo $PATH on the Solaris host I can see /usr/local/bin/ and Python on the Solaris box is /usr/local/bin/python (Python also works when I just type 'python' on the Solaris host). So I tried changing the script's first line to:
#!/usr/local/bin/python
And now it can run (but now breaks when I run it on the Oracle Enterprise Linux box). Not really sure what else I can do asides from point to different scripts with different first lines in the python script.
Hoping someone can shine some light on how I can implement this elegantly, thanks!
# PATH sets the initial shell PATH variable
#
#PATH=/usr/bin:
# SUPATH sets the initial shell PATH variable for root
#
#SUPATH=/usr/sbin:/usr/bin
So if it's not set in the /etc/default/login file, I'm thinking Ansible is pulling from somewhere else? As Brian said, Ansible is attempting to run in a non-interactive manner and where it's pulling the PATH from is unknown to me.