Hi Ian, This is actually a feature we are currently working on, specifically as part of our "v2" refactoring Michael mentioned in another thread on this group. This will most likely be available in version 1.9 in the future, but for now using roles and include statements with tags is the best way to group related tasks.
Thanks! On Fri, Oct 24, 2014 at 5:54 PM, Brian Coca <[email protected]> wrote: > you can already do some of this, with variables and tags, with include > and role directives. But currently there is only one true block of > tasks and that is a play. > > there is some work in ansible to create the block concept/object for > tasks but it is in early stages. > > On Fri, Oct 24, 2014 at 2:46 PM, Ian Denhardt <[email protected]> wrote: > > Hey > > > > Does ansible have a way of grouping multiple tasks into one (akin to a > > block statement in many programming languages)? I've several tasks that > > I want to (a) apply some common options to, such as sudo: yes, and (b) > > do in a loop (with_items). I could put these in a separate role, but > > that seems very heavyweight, and in my case I'm already inside of a role > > that I'd like to be self-contained. I haven't been able to find anything > > that lets me do this -- I tried hacking around it by putting an include > > statement as the task, but got an error saying that using that with > > with_items had been removed after being deprecated. That's more than > > reasonable -- it's pretty ugly -- but I can't find a better way to do > > this. > > > > Thoughts? > > > > -Ian > > > > > > -- > Brian Coca > Stultorum infinitus est numerus > > 0110000101110010011001010110111000100111011101000010000001111001011011110111010100100000011100110110110101100001011100100111010000100001 > Pedo mellon a minno > > -- > 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/CADn%2BHsy6WQv8ix0rBMPrOxWm5hx%3D%3DuYovrdtFGsn-_haUCH0ig%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/CAMFyvFitNpPTpRzedBi%2Byeq%3DX353J2cnAqVVZjSMu1h_NWPmeA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
