Executing python script through ansible keeps saying that Permission denied even though become: yes is specified

39 views
Skip to first unread message

Robert Grossman

unread,
Sep 21, 2016, 1:26:42 PM9/21/16
to Ansible Project
Hi,

I am new to ansible and I have been trying to execute a python script through a task. I have tried the command, script, and shell modules, but ansible is unable to execute this script. If I try using the command module, ansible says that the script is not there even though when I ssh into the machine and use the same command, it works. I doubt that this is a permissions issue since I am using become: yes to tell ansible to execute this script as sudo. When I try to execute this script with the script and shell modules, the task fails saying that permission was denied. I have tried using become and become_user, but I still get this error message. Any suggestions?

Thanks!

Andrew Feller

unread,
Sep 22, 2016, 8:48:11 AM9/22/16
to Ansible Project
Not sure if it's your problem but one thing that gets people is http://docs.ansible.com/ansible/become.html#can-t-limit-escalation-to-certain-commands :

Privilege escalation permissions have to be general. Ansible does not always use a specific command to do something but runs modules (code) from a temporary file name which changes every time. If you have ‘/sbin/service’ or ‘/bin/chmod’ as the allowed commands this will fail with ansible as those paths won’t match with the temporary file that ansible creates to run the module.
Reply all
Reply to author
Forward
0 new messages