|
|
@ -237,6 +237,13 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
aliases: []
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
network_interfaces:
|
|
|
|
|
|
|
|
version_added: "2.0"
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- 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: []
|
|
|
|
|
|
|
|
|
|
|
|
author:
|
|
|
|
author:
|
|
|
|
- "Tim Gerla (@tgerla)"
|
|
|
|
- "Tim Gerla (@tgerla)"
|
|
|
@ -823,11 +830,21 @@ def create_instances(module, ec2, vpc, override_count=None):
|
|
|
|
count_tag = module.params.get('count_tag')
|
|
|
|
count_tag = module.params.get('count_tag')
|
|
|
|
source_dest_check = module.boolean(module.params.get('source_dest_check'))
|
|
|
|
source_dest_check = module.boolean(module.params.get('source_dest_check'))
|
|
|
|
termination_protection = module.boolean(module.params.get('termination_protection'))
|
|
|
|
termination_protection = module.boolean(module.params.get('termination_protection'))
|
|
|
|
|
|
|
|
network_interfaces = module.params.get('network_interfaces')
|
|
|
|
|
|
|
|
|
|
|
|
# group_id and group_name are exclusive of each other
|
|
|
|
# group_id and group_name are exclusive of each other
|
|
|
|
if group_id and group_name:
|
|
|
|
if group_id and group_name:
|
|
|
|
module.fail_json(msg = str("Use only one type of parameter (group_name) or (group_id)"))
|
|
|
|
module.fail_json(msg = str("Use only one type of parameter (group_name) or (group_id)"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (network_interfaces and
|
|
|
|
|
|
|
|
(assign_public_ip or private_ip or vpc_subnet_id
|
|
|
|
|
|
|
|
or group_name or group_id)):
|
|
|
|
|
|
|
|
module.fail_json(
|
|
|
|
|
|
|
|
msg=str("network_interfaces must not be set when specifying " +
|
|
|
|
|
|
|
|
"assign_public_ip, private_ip, vpc_subnet_id, group, " +
|
|
|
|
|
|
|
|
"or group_id, which are used to create a new network " +
|
|
|
|
|
|
|
|
"interface."))
|
|
|
|
|
|
|
|
|
|
|
|
vpc_id = None
|
|
|
|
vpc_id = None
|
|
|
|
if vpc_subnet_id:
|
|
|
|
if vpc_subnet_id:
|
|
|
|
if not vpc:
|
|
|
|
if not vpc:
|
|
|
@ -923,11 +940,21 @@ def create_instances(module, ec2, vpc, override_count=None):
|
|
|
|
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
|
|
|
|
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
|
|
|
|
params['network_interfaces'] = interfaces
|
|
|
|
params['network_interfaces'] = interfaces
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
params['subnet_id'] = vpc_subnet_id
|
|
|
|
if network_interfaces:
|
|
|
|
if vpc_subnet_id:
|
|
|
|
interfaces = []
|
|
|
|
params['security_group_ids'] = group_id
|
|
|
|
for i, network_interface_id in enumerate(network_interfaces):
|
|
|
|
|
|
|
|
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
|
|
|
|
|
|
|
|
network_interface_id=network_interface_id,
|
|
|
|
|
|
|
|
device_index=i)
|
|
|
|
|
|
|
|
interfaces.append(interface)
|
|
|
|
|
|
|
|
params['network_interfaces'] = \
|
|
|
|
|
|
|
|
boto.ec2.networkinterface.NetworkInterfaceCollection(*interfaces)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
params['security_groups'] = group_name
|
|
|
|
params['subnet_id'] = vpc_subnet_id
|
|
|
|
|
|
|
|
if vpc_subnet_id:
|
|
|
|
|
|
|
|
params['security_group_ids'] = group_id
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
params['security_groups'] = group_name
|
|
|
|
|
|
|
|
|
|
|
|
if volumes:
|
|
|
|
if volumes:
|
|
|
|
bdm = BlockDeviceMapping()
|
|
|
|
bdm = BlockDeviceMapping()
|
|
|
@ -1281,6 +1308,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')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|