"It's
when a fact (host-specific variable) is used that a problem occurs:
the value for the first host is used for all hosts."
group_by was definitely intended to work with fact based variables, in
fact, this is the most common pattern:
- group_by: key=os-{{ ansible_os_family }}
We'll have to look into the looping scope question.
Ticket is filed here for those interested:
https://github.com/ansible/ansible/issues/7540
On Sun, May 25, 2014 at 4:41 PM, Joost Cassee <[email protected]> wrote:
> 2014-05-23 14:38 GMT+02:00 Michael DeHaan <[email protected]>:
> > I'm not positive group_by can be used with with_items.
> >
> > I think we may have proposed making this raise an error, which seems
> easy to
> > do if this is the case.
>
> Well, using a fixed list does work, adding every item as a group. It's
> when a fact (host-specific variable) is used that a problem occurs:
> the value for the first host is used for all hosts.
>
> > If you feel you can boil this down to a minimal reproducer example please
> > file a bug in github and we can take a look. I'd probably just do it
> with
> > a hard coded list for starters, just to make sure variables have nothing
> to
> > do with it (as it would provide more information if they did).
>
> I have removed the test_items variable and submitted an issue:
> https://github.com/ansible/ansible/issues/7540
>
> > Sidenote - it's very unusual to put variables below your tasks section.
> I'd
> > suggest not doing that as it makes playbooks less readable.
>
> Yeah, that was probably because I went through stripped down a role to
> a playbook in alphabetical order. :-)
>
> 2014-05-23 16:19 GMT+02:00 Adam Morris <[email protected]>:
> > This seems to be doing what you are telling it to do to me.
> >
> > [...]
> >
> > The one part I'm not sure about is whether host-inventoryname is being
> defined once and they are only being put in one group or if they are being
> put in multiple groups each.
>
> That is my point. I would expect every host to be put in their own
> group. If you us a fact but not with_items it works. I have included
> an example in the issue.
>
> Regards,
> Joost
>
> --
> Joost Cassee
> http://joost.cassee.net
>
> --
> 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/CAEQrH%2BcULb%2BC7O3DtbN%3DBZSG8YEph3enixN%2BeEy-SgDmpNsq5g%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/CA%2BnsWgyGO_MwMXfsQ_u4eA7c8byjHL-LyicXL7x%2BLz5L6wN5ZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.