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!

On Mon, Dec 21, 2015 at 5:39 PM, Matt Martz <[email protected]> wrote:

> What are you trying to achieve?  Ansible waits until the script exits
> before moving on.  Your python script appears that it will never exit.
>
> I think what you are looking for is "fire and forget" functionality?
>
> If so, you can achieve that by using async and poll.  A poll value of 0
> will allow the fire and forget.  See
> http://docs.ansible.com/ansible/playbooks_async.html
>
> On Mon, Dec 21, 2015 at 2:57 PM, richard kappler <[email protected]>
> wrote:
>
>> 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:
>>
>> ---
>> - name: test stop and start test.py
>>   hosts: servers
>>   tasks:
>>
>>     - name: kill pyscript
>>       shell: pkill -f test.py
>>
>>     - name: start script
>>       command: python /test/test/py
>>
>> This works, sort of but not really :-) test.py gets killed, sure enough,
>> and "start script" in the playbook executes, but then ansible just sits
>> there, Ho-Ho-Ho-ing me.
>>
>>
>> TASK: [start script] *****************************************
>>
>> For oooh long time until I give up and Control-C it.
>>
>> It is executing though, because when I go to the 'remote server' test.py
>> is indeed running.
>>
>> What the heck am I missing????
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/fc1b637b-460c-4a0d-9249-001e47008a76%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/fc1b637b-460c-4a0d-9249-001e47008a76%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Matt Martz
> @sivel
> sivel.net
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/EXxZdKpUuaw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAD8N0v-AvdoxG8Q3QFHPr3NghHwDtSHM25HeNuRqMTSS0wrrZQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAD8N0v-AvdoxG8Q3QFHPr3NghHwDtSHM25HeNuRqMTSS0wrrZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

All internal models of the world are approximate. ~ Sebastian Thrun

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAG7edPHm7ON0wYwFbwjABfb1M8RjaSUGOnjrDCXCR5xnHRaCAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to