ec2.py groups

157 views
Skip to first unread message

Yves Dorfsman

unread,
Jan 10, 2014, 1:10:24 PM1/10/14
to ansible...@googlegroups.com

When using dynamic inventory, my understanding is that you group your hosts
with EC2 tags. How do you add a host to two groups then, since EC2 can only
take one value for a given key?

Example:
text inventory:

[web]
sever1
server2

[app]
server1
server3

In EC2, I use a tag called 'group', but I can only have one value for that
group, either web or app...

Anybody run into this issue?


Thanks.


--
Yves.

Peter Gehres

unread,
Jan 10, 2014, 1:44:59 PM1/10/14
to ansible...@googlegroups.com
You could invert the key:value paradigm for groups and make them: "web:group" and "app:group" which would yield tag_web_group and tag_app_group. It isn't pretty but it would work.





--
Yves.

--
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+unsubscribe@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.



--
Peter Gehres
Site Reliability Engineer | AppDynamics, Inc.

Yves Dorfsman

unread,
Jan 10, 2014, 3:58:10 PM1/10/14
to ansible...@googlegroups.com
Yes I guess...

I'm a bit surprised and worried to only get one answer. Are there many people
out there using the dynamic inventory with ec2.py (I like to use well tested,
well used modules)?

Anybody else solved the issue of belonging to more than one group another way?

Thanks.
> email to ansible-project+unsubscribe@__googlegroups.com
> <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> To post to this group, send email to ansible-project@googlegroups.__com
> <mailto:ansible...@googlegroups.com>.
> For more options, visit https://groups.google.com/__groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
>
> --
> Peter Gehres
> Site Reliability Engineer | AppDynamics, Inc.
> www.appdynamics.com <http://www.appdynamics.com> | AS62897
>
> --
> 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-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.


--
Yves.

Peter Gehres

unread,
Jan 10, 2014, 4:55:07 PM1/10/14
to ansible...@googlegroups.com
Well, from an ansible perspective, the way we do it is not by multiple groups. We use roles instead. So, for example, one of our "utility hosts" in ec2 is an ldap-slave, splunk forwarder, bastion host, etc. Instead of tagging each group we use tag_aws_utility and then run all of those roles in the playbook.



    For more options, visit https://groups.google.com/__groups/opt_out
    <https://groups.google.com/groups/opt_out>.





--
Peter Gehres
Site Reliability Engineer | AppDynamics, Inc.
www.appdynamics.com <http://www.appdynamics.com> | AS62897


--
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

For more options, visit https://groups.google.com/groups/opt_out.


--
Yves.

--
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+unsubscribe@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.



--
Peter Gehres
Site Reliability Engineer | AppDynamics, Inc.

ghe...@gmail.com

unread,
Apr 10, 2014, 8:14:39 PM4/10/14
to ansible...@googlegroups.com
  Sorry for necro-ing this.  

  We solved this by adding the whole pair to the tag key itself, so it creates groups like tag_class_database_ (mapped from "class_database": "").  

  Now you can add machines to multiple groups, filter machines that are in more than one class, etc.


    To post to this group, send email to ansible-project@googlegroups.__com

    For more options, visit https://groups.google.com/__groups/opt_out
    <https://groups.google.com/groups/opt_out>.





--
Peter Gehres
Site Reliability Engineer | AppDynamics, Inc.
www.appdynamics.com <http://www.appdynamics.com> | AS62897


--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
Yves.

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Michael DeHaan

unread,
Apr 15, 2014, 5:04:06 PM4/15/14
to ansible...@googlegroups.com

Mike Trienis

unread,
May 13, 2015, 12:10:01 AM5/13/15
to ansible...@googlegroups.com
Hi guys, 

I have the exact same issue and can not seem to find an elegant solution.  

Does anyone have a better solution than the inverted key value paradigm?

Also, has anyone manage to automate the route53 entries using the dynamic inventory file?

Thanks, Mike. 


On Friday, 10 January 2014 10:44:59 UTC-8, Peter Gehres wrote:
You could invert the key:value paradigm for groups and make them: "web:group" and "app:group" which would yield tag_web_group and tag_app_group. It isn't pretty but it would work.
On Fri, Jan 10, 2014 at 10:10 AM, Yves Dorfsman <yv...@zioup.com> wrote:

When using dynamic inventory, my understanding is that you group your hosts with EC2 tags. How do you add a host to two groups then, since EC2 can only take one value for a given key?

Example:
text inventory:

    [web]
    sever1
    server2

    [app]
    server1
    server3

In EC2, I use a tag called 'group', but I can only have one value for that group, either web or app...

Anybody run into this issue?


Thanks.



--
Yves.

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages