From e9fbb5f1b6aa136501ec1341adf4c46ceb3ed98a Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 12 Nov 2014 11:04:43 -0600 Subject: [PATCH] Serialize tag attributes to ASG properties in ec2_asg Fixes #108 --- lib/ansible/modules/cloud/amazon/ec2_asg.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/ansible/modules/cloud/amazon/ec2_asg.py b/lib/ansible/modules/cloud/amazon/ec2_asg.py index 4940d0d9dcd..e1b5464703f 100755 --- a/lib/ansible/modules/cloud/amazon/ec2_asg.py +++ b/lib/ansible/modules/cloud/amazon/ec2_asg.py @@ -245,6 +245,10 @@ def get_properties(autoscaling_group): properties['pending_instances'] += 1 properties['instance_facts'] = instance_facts properties['load_balancers'] = autoscaling_group.load_balancers + + if hasattr(autoscaling_group, "tags"): + properties['tags'] = dict((t.key, t.value) for t in autoscaling_group.tags) + return properties @@ -357,6 +361,7 @@ def create_autoscaling_group(connection, module): continue if changed: connection.create_or_update_tags(asg_tags) + as_group.tags = asg_tags # handle loadbalancers separately because None != [] load_balancers = module.params.get('load_balancers') or []