When, I'm running a Python script via an Ansible playbook, I get the following error:
fatal: [localhost]: FAILED! => {"changed": false, "cmd": "/Dest/To/Repo/HW.py", "failed": true, "msg": "[Errno 13] Permission denied", "rc": 13} I did add the sudo: yes line:
Here is my yaml file:
- name: a play that runs entirely on the ansible host hosts: 127.0.0.1 sudo: yes connection: local tasks: - name: check out a git repository git: repo={{ repo_url }} dest=/Dest/To/Repo/ accept_hostkey=yes vars: repo_url: https://github.com/lorin/mezzanine-example.git - name: Running the Python Script command: /Dest/To/Repo/HW.py The HW.py script is just print("Hello World")
Is there anything which I need to do, regarding the permissions error?
HW.pyfile may not have execution rights. Try the following command:command: /usr/bin/python /Dest/To/Repo/HW.py[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.. How do I handle it, in a remote EC2?sudo: yeswithbecome: yes