# Changes in ec2.py that will break things

**URL:** <https://forum.ansible.com/t/changes-in-ec2-py-that-will-break-things/18179>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [May 7, 2015, 3:24am UTC](https://forum.ansible.com/t/changes-in-ec2-py-that-will-break-things/18179 "2015-05-07T03:24:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navid\_Paya](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@Navid\_Paya](https://forum.ansible.com/u/Navid_Paya)\
**Post date:** [May 7, 2015, 3:24am UTC](https://forum.ansible.com/t/changes-in-ec2-py-that-will-break-things/18179/1 "2015-05-07T03:24:26Z")

</div>

Hi guys

I’ve already posted this to the Tower support channel but was told to post it here as well since this is part of Ansible Core rather than Ansible Tower.

I have an older version of ec2.py and ec2.ini checked into my repo from a while ago. Today I decided to update it. After that none of my playbooks matched my EC2 instances and I got empty host lists from pretty much everything. So I started looking around. What I found out is that the new one changes all “-” in my tag names to “\_”. Just wanted to know if Tower uses the same ec2.py script because in that case everything will break for me when this is released to Tower.

For instance I have an autoscaling group called “prd-gamma-api”. With the old script, I can find its members using “tag\_aws\_autoscaling\_groupName\_prd-gamma-api” but in the new one it’s “tag\_aws\_autoscaling\_groupName\_prd\_gamma\_api”. You can see the result is this gist:

[https://gist.github.com/navidpaya/0b6f7c349a84a0041356](https://gist.github.com/navidpaya/0b6f7c349a84a0041356)

And if this is going to be the behavior, I think it’s a very bad one. Why would the script tamper with the tags that AWS accepts? It would cause a lot of confusion.

Cheers

Navid

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [May 7, 2015, 2:16pm UTC](https://forum.ansible.com/t/changes-in-ec2-py-that-will-break-things/18179/2 "2015-05-07T14:16:24Z")

</div>

The issue is that - in the group names breaks things, it still works  
for matching hosts to a play but it makes it difficult to use other  
features as python does not like '-' in variables or as dictionary  
keys.

---

<div class="post-metadata">

**Author:** ![Navid\_Paya](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@Navid\_Paya](https://forum.ansible.com/u/Navid_Paya)\
**Post date:** [May 7, 2015, 2:24pm UTC](https://forum.ansible.com/t/changes-in-ec2-py-that-will-break-things/18179/3 "2015-05-07T14:24:40Z")

</div>

I agree and I was personally opposed to them being used but again, if - is allowed by AWS, changing them in Ansible is just too intrusive since this plugin is used only by EC2 instances. Is it possible to at least have an option to make the script act in the old way?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [May 7, 2015, 2:31pm UTC](https://forum.ansible.com/t/changes-in-ec2-py-that-will-break-things/18179/4 "2015-05-07T14:31:53Z")

</div>

I would not be opposed to make this configurable via ec2.ini, I would  
make it default to the new behavior just to avoid more problems in the  
future.

---

<div class="post-metadata">

**Author:** ![Navid\_Paya](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@Navid\_Paya](https://forum.ansible.com/u/Navid_Paya)\
**Post date:** [May 7, 2015, 3:34pm UTC](https://forum.ansible.com/t/changes-in-ec2-py-that-will-break-things/18179/5 "2015-05-07T15:34:53Z")

</div>

That would totally work for me. Thanks, Brian.
