I've never tried this but I would think you could just use the hosts
option in the the parent playbook?

Something like:

- hosts: all
  roles:
     - generate_groups  # generates group1, group2, etc

- hosts: group1
  roles:
     - do_something_with_a_group

Otherwise you might try:

- hosts: all
  roles:
     - { role:do_something_with_a_group, when: inventory_host in
groups["group1"] }



Kahlil (Kal) Hodgson                       GPG: C9A02289
Head of Technology                         (m) +61 (0) 4 2573 0382
DealMax Pty Ltd                            (w) +61 (0) 3 9008 5281

Suite 1415
401 Docklands Drive
Docklands VIC 3008 Australia

"All parts should go together without forcing.  You must remember that
the parts you are reassembling were disassembled by you.  Therefore,
if you can't get them together again, there must be a reason.  By all
means, do not use a hammer."  -- IBM maintenance manual, 1925



On Tue, Jan 7, 2014 at 7:30 AM, Mark Casey <mark.cas...@gmail.com> wrote:
> Hello everyone,
>
> My situation is that my playbook calls a role to split my hosts up using
> group_by. I then immediately call another role in which I want to use the
> newly created groups.
>
> The problem is that in the second role I cannot (to my knowledge) start new
> plays within ../role/task/main.yml to use the hosts: option to limit by
> these new groups. Can I use when to limit which tasks run in the second role
> instead (I realize this might cause a lot of skipped tasks)?
>
> Please let me know if my description is too brief/confusing, I didn't want
> to make anyone read a novel.
>
> Thank you,
> Mark
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to