I need to stop and then start a python script on numerous remote servers. I set up a vm in our test environment to walk through this. The ‘remote server’ has a simple python script (test.py) in /test directory:
`
#!/usr/bin/env python
while True:
print “running\n”
`
my playbook has a hosts file:
[servers] 192.168.2.31
which is the IP of the ‘remote host’ in the test environment.
I have tried the playbook several ways, using shell, script and command to execute test.py, shell and script didn’t work, command did but then the playbook hangs:
That is exactly what I was looking for, thanks! As far as what I was looking for, you were correct in that it is fire and forget, this script runs constantly, we just need to be able to shut it down occassionaly for various reasons, then restart it. I must have missed the bit in the docs that say ansible waits for the completion/output of tasks. Makes sense now. Thanks again Matt!