Best practice to set up command that will run only at first session

32 views
Skip to first unread message

Andrew Pashkin

unread,
May 2, 2014, 2:24:45 AM5/2/14
to ansible...@googlegroups.com
What is the good way to make command run only one time and never run it
again if once it succeeds?
I think it might be done by triggering a handler which creates a
flag-file after command succeds and also by defining a condition which
prevents command run if that flag-file exists.
But how to accomplish that? The problems that I can't solve here is:
1) How to trigger a handler only if command succeeds?
2) How to run commands only if certain file exists?

--
С наилучшими пожеланиями, Андрей Пашкин.
м.т - +7 (985) 898 57 59
Skype - waves_in_fluids
e-mail - andrew....@gmx.co.uk

James Cammarata

unread,
May 2, 2014, 9:22:20 AM5/2/14
to ansible...@googlegroups.com
The command/shell modules already do this with the creates/removes options. See the documentation here:




--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/53633A2D.5040007%40gmx.co.uk.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages