Changes in ec2.py that will break things

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

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

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.

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?

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.

That would totally work for me. Thanks, Brian.