I would like to run the python program on a remote node by copying the python program from control node using Ansible.
I was able to copy the file successfully, however it is not executing the python program on the remote server.
Error: "Could not find or access '/home/remote/files/program.py' on the Ansible Controller
- name: copy the program file to ubuntu
copy:
src: /home/ubuntu/ansible/program.py
dest: /home/remote/files/program.py
mode: '0777'
when: ansible_user== 'remote'
- name: Run the python script in remote
script: /home/pi/files/program.py
args:
executable: python3
when: ansible_user== 'remote'
script - Runs a local script on a remote node after transferring itfrom this link.docs.ansible.com/ansible/2.4/script_module.html so either change your script path to controller node's location, or usecommandorshellmodule to execute already copied script onremotemachine - JBone