From 14f488f8b6a0d19433fab6f649ac487473321b54 Mon Sep 17 00:00:00 2001 From: Stefan Horning Date: Mon, 20 Jun 2016 19:10:56 +0200 Subject: [PATCH] Get EIP association information for ENI if EIP is associated (#2082) --- lib/ansible/modules/extras/cloud/amazon/ec2_eni_facts.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/extras/cloud/amazon/ec2_eni_facts.py b/lib/ansible/modules/extras/cloud/amazon/ec2_eni_facts.py index 23e4a3d60f8..875c8207fdd 100644 --- a/lib/ansible/modules/extras/cloud/amazon/ec2_eni_facts.py +++ b/lib/ansible/modules/extras/cloud/amazon/ec2_eni_facts.py @@ -107,7 +107,13 @@ def get_eni_info(interface): 'groups': dict((group.id, group.name) for group in interface.groups), 'private_ip_addresses': private_addresses } - + + if hasattr(interface, 'publicDnsName'): + interface_info['association'] = {'public_ip_address': interface.publicIp, + 'public_dns_name': interface.publicDnsName, + 'ip_owner_id': interface.ipOwnerId + } + if interface.attachment is not None: interface_info['attachment'] = {'attachment_id': interface.attachment.id, 'instance_id': interface.attachment.instance_id,