My playbook is as below:
- hosts : mygroup
user : user
sudo : yes
tasks :
- name : Copy script
copy : 'src=/home/user/Scripts/logchecker.py dest=/opt/root2/logchecker.py owner=root group=root mode=755'
- name : Execute script
command : '/usr/bin/python /opt/root2/logchecker.py'
The file upload is working, But execution is failing. Even though I am able to execute the script without any issues directly on the server. Am I doing anything wrong?
I have used a similar playbook which works as expected:
And test.py:
Running the playboook:
Shows:
And on the remote host:
Several differences between our setup:
Hopefully this can point you in the right direction of where the differences might be.
You need only Below plugin script to use