I suspect the code is looking for a "hosts" entry in the JSON, and it's not
there.  Can you try adding an empty "hosts" array in that group response?





On Thu, Apr 17, 2014 at 7:31 AM, Dane <[email protected]> wrote:

> Hello list,
>
> I'm working on a dynamic inventory script for our Ansible deployment.
> Mostly we're going to be dealing with clusters of machines, so from our
> side we're grouping hosts into the cluster they'll be in and each host of a
> cluster has the same set of Ansible variables pushed to it.
>
> These groups of clusters then need to be assigned to the type of cluster
> they are in Ansible so we run the correct playbook against them - lets say
> we have clusters of layer 4 and layer 7 loadbalancers and some HA Varnish
> boxes, so we'd have three Ansible groups "l4", "l7" and "varnish" and these
> would get assigned appropriate Ansible roles. Since each cluster should get
> the same set of variables, it made sense to me that these should go into
> group_vars, then each host may or may not have individual host_vars.
>
> This is what my dynamic inventory script is currently spitting out (excuse
> the random names, I auto-generated the test data from
> /usr/share/dict/words!): http://p.rig.gr/view/6472db0c
>
> You can see that I've got the cluster groups at the top level, but then
> I'm trying to group these within Ansible:
>
>     "varnish": {
>         "children": [
>             "turbinate80",
>             "roofgarden90"
>         ]
>     }
>
>
> This way, I know that the clusters "turbinate80" and "roofgarden90" (which 
> both contain two hosts each) are Varnish boxes and should run the Varnish 
> role. The hosts inside those groups will get their associated group_vars, 
> then pull in any host vars from the _meta bit (currently empty).
>
>
> What actually happens is that the 'empty' varnish group (and l4/l7) is being 
> picked up as a host in it's own right, rather than as just a group:
>
>
> (env)[dane@shrike ...nsible/spire]% ansible all -i spire.py --list-hosts
>
>     192.168.0.131
>
>     192.168.0.132
>
>     192.168.0.115
>
>     192.168.0.116
>
>     192.168.0.130
>
>     192.168.0.129
>
>     l7
>
>     192.168.0.15
>
>     192.168.0.16
>
>     192.168.0.25
>
>     192.168.0.26
>
>     l4
>
>     webcel
>
>
> (env)[dane@shrike ...nsible/spire]% ansible l4 -i spire.py --list-hosts
>     l4
>     192.168.0.131
>     192.168.0.132
>
>
>
> Now, I can move stuff around to make this work (getting rid of group_vars
> and dumping everything under _meta, even though this will duplicate some
> stuff), but I'm wondering if there's a way to do what I'm after (group of
> groups, I guess) or if I'm just approaching this in the wrong way?
>
> Thanks
>
> Dane
>
>
>
>  --
> 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/957c0128-4b7c-4f76-9768-5a82fedf299a%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/957c0128-4b7c-4f76-9768-5a82fedf299a%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/CA%2BnsWgy13B2HpWxHQEcusEXAwwxC08HT4-a8gYDoscd63VMreQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to