Add alias `network_interface` and accept a string for a single ENI

reviewable/pr18780/r1
Bret Martin 9 years ago
parent 5db3f14e94
commit 44f3618dd3

@ -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.) - 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 required: false
default: null default: null
aliases: ['network_interface']
author: author:
- "Tim Gerla (@tgerla)" - "Tim Gerla (@tgerla)"
@ -358,7 +359,13 @@ EXAMPLES = '''
vpc_subnet_id: subnet-29e63245 vpc_subnet_id: subnet-29e63245
assign_public_ip: yes 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: - ec2:
key_name: mykey key_name: mykey
instance_type: t2.small instance_type: t2.small
@ -950,6 +957,8 @@ def create_instances(module, ec2, vpc, override_count=None):
params['network_interfaces'] = interfaces params['network_interfaces'] = interfaces
else: else:
if network_interfaces: if network_interfaces:
if isinstance(network_interfaces, basestring):
network_interfaces = [network_interfaces]
interfaces = [] interfaces = []
for i, network_interface_id in enumerate(network_interfaces): for i, network_interface_id in enumerate(network_interfaces):
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification( interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
@ -1317,7 +1326,7 @@ def main():
volumes = dict(type='list'), volumes = dict(type='list'),
ebs_optimized = dict(type='bool', default=False), ebs_optimized = dict(type='bool', default=False),
tenancy = dict(default='default'), tenancy = dict(default='default'),
network_interfaces = dict(type='list') network_interfaces = dict(type='list', aliases=['network_interface'])
) )
) )

Loading…
Cancel
Save