diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index 5fb17255a0e..10791439556 100755 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -593,7 +593,8 @@ def get_instance_info(inst): 'state': inst.state, 'hypervisor': inst.hypervisor, 'tags': inst.tags, - 'groups': {group.id: group.name for group in inst.groups}} + 'groups': dict((group.id, group.name) for group in inst.groups), + } try: instance_info['virtualization_type'] = getattr(inst,'virtualization_type') except AttributeError: