Add alias network_interface and accept a string for a single ENI

This commit is contained in:
Bret Martin 2015-09-06 13:53:28 -04:00
parent 5db3f14e94
commit 44f3618dd3

View file

@ -246,6 +246,7 @@ options:
- A list of existing network interfaces to attach to the instance at launch. When specifying existing network interfaces, none of the assign_public_ip, private_ip, vpc_subnet_id, group, or group_id parameters may be used. (Those parameters are for creating a new network interface at launch.)
required: false
default: null
aliases: ['network_interface']
author:
- "Tim Gerla (@tgerla)"
@ -358,7 +359,13 @@ EXAMPLES = '''
vpc_subnet_id: subnet-29e63245
assign_public_ip: yes
# Example using pre-existing network interfaces
# Examples using pre-existing network interfaces
- ec2:
key_name: mykey
instance_type: t2.small
image: ami-f005ba11
network_interface: eni-deadbeef
- ec2:
key_name: mykey
instance_type: t2.small
@ -950,6 +957,8 @@ def create_instances(module, ec2, vpc, override_count=None):
params['network_interfaces'] = interfaces
else:
if network_interfaces:
if isinstance(network_interfaces, basestring):
network_interfaces = [network_interfaces]
interfaces = []
for i, network_interface_id in enumerate(network_interfaces):
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
@ -1317,7 +1326,7 @@ def main():
volumes = dict(type='list'),
ebs_optimized = dict(type='bool', default=False),
tenancy = dict(default='default'),
network_interfaces = dict(type='list')
network_interfaces = dict(type='list', aliases=['network_interface'])
)
)