You're looking for parameterized roles. Put the tasks in a role, call the role conditionally when the criteria is met.
http://docs.ansible.com/playbooks_conditionals.html#applying-when-to-roles-and-includes On Thu, Apr 10, 2014 at 4:38 AM, Stephan S. <[email protected]> wrote: > Hello. > > I would like to know if it is possible to enclose multiple tasks with one > when clause. > I am trying to avoid to use the same when statement for all of my tasks in > the same playbook. > > Furthermore, as a requirement is that the above should be implemented > while using a single playbook. > So all of the statements while also the single when clause that controls > those tasks should be in the same > playbook. > > Is something like this possible? > > Thank you in advance. > > -- > 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/5470ce46-855e-42c8-875a-af68db46ea5d%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/5470ce46-855e-42c8-875a-af68db46ea5d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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/CAK6JQEFrdn3y6q-SU-qSn3k6mzxRmTMah-_eprkFW9c4Us0-3A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
