fixing bug where if both private_ip and assign_public_p are set ansible fails out
This commit is contained in:
parent
f547733b1f
commit
88b30a74d2
1 changed files with 31 additions and 14 deletions
|
@ -814,13 +814,21 @@ def create_instances(module, ec2, override_count=None):
|
||||||
msg="assign_public_ip only available with vpc_subnet_id")
|
msg="assign_public_ip only available with vpc_subnet_id")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
|
if private_ip:
|
||||||
subnet_id=vpc_subnet_id,
|
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
|
||||||
groups=group_id,
|
subnet_id=vpc_subnet_id,
|
||||||
associate_public_ip_address=assign_public_ip)
|
private_ip_address=private_ip,
|
||||||
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
|
groups=group_id,
|
||||||
params['network_interfaces'] = interfaces
|
associate_public_ip_address=assign_public_ip)
|
||||||
|
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
|
||||||
|
params['network_interfaces'] = interfaces
|
||||||
|
else:
|
||||||
|
interface = boto.ec2.networkinterface.NetworkInterfaceSpecification(
|
||||||
|
subnet_id=vpc_subnet_id,
|
||||||
|
groups=group_id,
|
||||||
|
associate_public_ip_address=assign_public_ip)
|
||||||
|
interfaces = boto.ec2.networkinterface.NetworkInterfaceCollection(interface)
|
||||||
|
params['network_interfaces'] = interfaces
|
||||||
else:
|
else:
|
||||||
params['subnet_id'] = vpc_subnet_id
|
params['subnet_id'] = vpc_subnet_id
|
||||||
if vpc_subnet_id:
|
if vpc_subnet_id:
|
||||||
|
@ -842,13 +850,22 @@ def create_instances(module, ec2, override_count=None):
|
||||||
|
|
||||||
# check to see if we're using spot pricing first before starting instances
|
# check to see if we're using spot pricing first before starting instances
|
||||||
if not spot_price:
|
if not spot_price:
|
||||||
params.update(dict(
|
if assign_public_ip and private_ip:
|
||||||
min_count = count_remaining,
|
params.update(dict(
|
||||||
max_count = count_remaining,
|
min_count = count_remaining,
|
||||||
client_token = id,
|
max_count = count_remaining,
|
||||||
placement_group = placement_group,
|
client_token = id,
|
||||||
private_ip_address = private_ip,
|
placement_group = placement_group,
|
||||||
))
|
))
|
||||||
|
else:
|
||||||
|
params.update(dict(
|
||||||
|
min_count = count_remaining,
|
||||||
|
max_count = count_remaining,
|
||||||
|
client_token = id,
|
||||||
|
placement_group = placement_group,
|
||||||
|
private_ip_address = private_ip,
|
||||||
|
))
|
||||||
|
|
||||||
res = ec2.run_instances(**params)
|
res = ec2.run_instances(**params)
|
||||||
instids = [ i.id for i in res.instances ]
|
instids = [ i.id for i in res.instances ]
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in a new issue