|
|
|
@ -195,9 +195,6 @@ def create_eni(connection, module):
|
|
|
|
|
instance_id = module.params.get("instance_id")
|
|
|
|
|
if instance_id == 'None':
|
|
|
|
|
instance_id = None
|
|
|
|
|
do_detach = True
|
|
|
|
|
else:
|
|
|
|
|
do_detach = False
|
|
|
|
|
device_index = module.params.get("device_index")
|
|
|
|
|
subnet_id = module.params.get('subnet_id')
|
|
|
|
|
private_ip_address = module.params.get('private_ip_address')
|
|
|
|
@ -212,7 +209,7 @@ def create_eni(connection, module):
|
|
|
|
|
if instance_id is not None:
|
|
|
|
|
try:
|
|
|
|
|
eni.attach(instance_id, device_index)
|
|
|
|
|
except BotoServerError as ex:
|
|
|
|
|
except BotoServerError:
|
|
|
|
|
eni.delete()
|
|
|
|
|
raise
|
|
|
|
|
# Wait to allow creation / attachment to finish
|
|
|
|
@ -236,8 +233,6 @@ def modify_eni(connection, module):
|
|
|
|
|
else:
|
|
|
|
|
do_detach = False
|
|
|
|
|
device_index = module.params.get("device_index")
|
|
|
|
|
subnet_id = module.params.get('subnet_id')
|
|
|
|
|
private_ip_address = module.params.get('private_ip_address')
|
|
|
|
|
description = module.params.get('description')
|
|
|
|
|
security_groups = module.params.get('security_groups')
|
|
|
|
|
force_detach = module.params.get("force_detach")
|
|
|
|
@ -245,7 +240,6 @@ def modify_eni(connection, module):
|
|
|
|
|
delete_on_termination = module.params.get("delete_on_termination")
|
|
|
|
|
changed = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# Get the eni with the eni_id specified
|
|
|
|
|
eni_result_set = connection.get_all_network_interfaces(eni_id)
|
|
|
|
@ -376,7 +370,7 @@ def main():
|
|
|
|
|
if region:
|
|
|
|
|
try:
|
|
|
|
|
connection = connect_to_aws(boto.ec2, region, **aws_connect_params)
|
|
|
|
|
except (boto.exception.NoAuthHandlerFound, StandardError), e:
|
|
|
|
|
except (boto.exception.NoAuthHandlerFound, AnsibleAWSError), e:
|
|
|
|
|
module.fail_json(msg=str(e))
|
|
|
|
|
else:
|
|
|
|
|
module.fail_json(msg="region must be specified")
|
|
|
|
@ -403,4 +397,5 @@ from ansible.module_utils.ec2 import *
|
|
|
|
|
# this is magic, see lib/ansible/module_common.py
|
|
|
|
|
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main()
|
|
|
|
|