See discussion here: https://github.com/ansible/ansible/pull/7421
On Thu, May 15, 2014 at 11:51 AM, Michael Peters <[email protected]>wrote: > Thanks, that actually helps a lot. Although, it does litter all my > tasks in the "critical section" play with that conditional and makes > existing conditionals more complex. > > It would still be cleaner to have an option on the play itself and/or > individual tasks. I know there's some hesitation to add new keywords > (which is good imo) but this seems common enough for lots of > update/deployment scenarios. I'd be willing to code something like > that if there's any interest in seeing it > > On Thu, May 15, 2014 at 11:33 AM, 'Petros Moisiadis' via Ansible > Project <[email protected]> wrote: > > On 05/15/14 17:25, Michael Peters wrote: > >> On Wed, May 14, 2014 at 6:15 PM, Michael DeHaan <[email protected]> > wrote: > >>> The multiple play method is correct because the tasks would not be > executed > >>> for every host in the host loop. > >> Well, then maybe I'm doing it wrong. How do you tell a play to just > >> execute on one host in the host loop? > >> Right now I run the "critical section" play with a serial of 1 and try > >> to leave some indicator that it was run (which is sometimes harder > >> than others) and then the subsequent hosts skip the tasks in the place > >> after they detect they weren't the first to try. > >> > >> So my approach is still wasteful since I know ahead of time that it's > >> only ever going to run once but every host in the loop besides the > >> first one has to detect the skip condition and skip every task in > >> serial. > >> > >>> Pause is a bit of an exception. > >> Does it have to be an exception? Can we expose that functionality to > >> other tasks or plays? I'd be willing to help with coding something if > >> you think it's worth it. > >> > > > > If a play acts on all hosts in 'somegroup' group, you can restrict a > > task in that play to run only on the first host in the group by adding > > the following conditional: > > > > when: inventory_hostname == groups["somegroup"][0] > > > > -- > > 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/5374DE51.7070801%40yahoo.gr > . > > For more options, visit https://groups.google.com/d/optout. > > -- > 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/CAJQqANfVKyF2bQbkBJg00mFrZnistuUyGUDCjkedh84Kkk4nLg%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CA%2BnsWgyuECNrVRqBoqroVEn_raQMGRaaOJMtzxXO7zdYf2oZAA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
