Ahh, if you're not wanting to completely bail out of the play entirely then
you have a few options:

1) start using tags to label your tasks and use the --tags or --skip-tags
options to control which parts are run/skipped.
2) move those tasks into a new file and use "include" with "when" to
control when those tasks are run.
3) split your playbook into roles (which can also use tags and when to
conditionally control execution).



On Mon, May 19, 2014 at 2:58 PM, Michael Peters
<[email protected]>wrote:

> That's close but not quite what I want. I don't want to halt execution
> entirely, just skip the rest of this play for this host. There are
> other plays involved that should be run (part of a multiple role
> setup). Also, if you use fail and it's combined with serial and
> max_fail_percentage it will cause the entire run to halt and for this
> play to not even be attempted on other hosts. I don't want this
> condition to trigger a "failure". It's more like "next" or "continue"
> in most programming languages. I know ansible is not a full language,
> but it already has lots of flow control capabilities I was just
> wondering if it had this one too.
>
> On Mon, May 19, 2014 at 3:47 PM, James Cammarata <[email protected]>
> wrote:
> > Yes, there is a "fail" module which will terminate execution, which you
> can
> > couple with the "when" keyword to target certain conditions.
> >
> > http://docs.ansible.com/fail_module.html
> >
> >
> > On Mon, May 19, 2014 at 1:51 PM, Michael Peters <
> [email protected]>
> > wrote:
> >>
> >> I was just wondering if there's a bail-out or break module/keyword
> >> that I can use to stop processing a play on that host after a certain
> >> condition is met.
> >>
> >> For instance, I'm doing some setup on some servers where some certain
> >> things need to happen based on how the machine was provisioned
> >> (hardware setup). The condition doesn't really belong in a group and
> >> doesn't change the server's role, just whether or not I need to run
> >> the rest of the play. I can determine this condition and I've used
> >> register + set_fact to make it available, but as it stands now I have
> >> to put a "when: do_all_the_things" on each and every subsequent task.
> >>
> >> Not a biggies, just wondering if there's a better way.
> >>
> >> --
> >> 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/CAJQqANf1R8Hib4ay9rM2Bb0U7rWeaRwMaQedyV1O7xnK-U7L8w%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/CAMFyvFgJR1BGGhLURu2urEuihDkas0fijFQyA%2BzctdH4krO8Lg%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/CAJQqANez3PeSd%2BdnruvJm8wstdHq2h_0CTs9ntminKu3Az5Kiw%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/CAMFyvFjosJxUKWB_bw2N9ZyMAc1%2BQvCHr-eYHn9cQv--WkajCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to