|
|
|
@ -813,6 +813,13 @@ def create_instances(module, ec2, override_count=None):
|
|
|
|
|
module.fail_json(
|
|
|
|
|
msg="assign_public_ip only available with vpc_subnet_id")
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
if private_ip:
|
|
|
|
|
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
|
|
|
|
|
subnet_id=vpc_subnet_id,
|
|
|
|
|
private_ip_address=private_ip,
|
|
|
|
|
groups=group_id,
|
|
|
|
|
associate_public_ip_address=assign_public_ip)
|
|
|
|
|
else:
|
|
|
|
|
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
|
|
|
|
|
subnet_id=vpc_subnet_id,
|
|
|
|
@ -820,7 +827,6 @@ def create_instances(module, ec2, override_count=None):
|
|
|
|
|
associate_public_ip_address=assign_public_ip)
|
|
|
|
|
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
|
|
|
|
|
params['network_interfaces'] = interfaces
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
params['subnet_id'] = vpc_subnet_id
|
|
|
|
|
if vpc_subnet_id:
|
|
|
|
@ -842,6 +848,14 @@ def create_instances(module, ec2, override_count=None):
|
|
|
|
|
|
|
|
|
|
# check to see if we're using spot pricing first before starting instances
|
|
|
|
|
if not spot_price:
|
|
|
|
|
if assign_public_ip and private_ip:
|
|
|
|
|
params.update(dict(
|
|
|
|
|
min_count = count_remaining,
|
|
|
|
|
max_count = count_remaining,
|
|
|
|
|
client_token = id,
|
|
|
|
|
placement_group = placement_group,
|
|
|
|
|
))
|
|
|
|
|
else:
|
|
|
|
|
params.update(dict(
|
|
|
|
|
min_count = count_remaining,
|
|
|
|
|
max_count = count_remaining,
|
|
|
|
@ -849,6 +863,7 @@ def create_instances(module, ec2, override_count=None):
|
|
|
|
|
placement_group = placement_group,
|
|
|
|
|
private_ip_address = private_ip,
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
res = ec2.run_instances(**params)
|
|
|
|
|
instids = [ i.id for i in res.instances ]
|
|
|
|
|
while True:
|
|
|
|
|