skip a play in a playbook?

1,369 views
Skip to first unread message

Jeremy Schulman

unread,
Feb 25, 2014, 7:18:41 AM2/25/14
to ansible...@googlegroups.com
lets say i have a playbook with three plays. i would like to skip the middle play if some condition is met. is this possible without having to add a 'when' condition to each task in the middle play?

thank you1

James Tanner

unread,
Feb 25, 2014, 7:39:42 AM2/25/14
to ansible...@googlegroups.com
Roles can be run conditionally, so you might want to look at transitioning the "middle" play to a role if you do not want to mark every task with a when: statement.


On Tue, Feb 25, 2014 at 7:18 AM, Jeremy Schulman <nwkaut...@gmail.com> wrote:
lets say i have a playbook with three plays.  i would like to skip the middle play if some condition is met.  is this possible without having to add a 'when' condition to each task in the middle play?

thank you1

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d4d1bd7b-4166-4861-b74f-c6b941af8229%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Michael DeHaan

unread,
Feb 25, 2014, 8:00:22 AM2/25/14
to ansible...@googlegroups.com
group_by is a really good module to use here, actually.

The benefit is that you don't see the "skipped" for every task in the role.


Run group_by in one task in play #1 and have play2 target the new temporary group.




Jeremy Schulman

unread,
Feb 25, 2014, 10:08:07 AM2/25/14
to ansible...@googlegroups.com
thank you, i will try those approaches. much appreciated!
Reply all
Reply to author
Forward
0 new messages