Running python script on anisble

Solution 1:

In order to run a python script in another directory, you will need to implement a chdir. Ansible allows you to do this through their args parameter.

Example:

- name: Execute Script
  command: python example.py
  args:
    chdir: /home/{{user_name}}/python_files/