|
|
@ -25,23 +25,28 @@ options:
|
|
|
|
- Ensure NAT Gateway is present or absent.
|
|
|
|
- Ensure NAT Gateway is present or absent.
|
|
|
|
default: "present"
|
|
|
|
default: "present"
|
|
|
|
choices: ["present", "absent"]
|
|
|
|
choices: ["present", "absent"]
|
|
|
|
|
|
|
|
type: str
|
|
|
|
nat_gateway_id:
|
|
|
|
nat_gateway_id:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The id AWS dynamically allocates to the NAT Gateway on creation.
|
|
|
|
- The id AWS dynamically allocates to the NAT Gateway on creation.
|
|
|
|
This is required when the absent option is present.
|
|
|
|
This is required when the absent option is present.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
subnet_id:
|
|
|
|
subnet_id:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The id of the subnet to create the NAT Gateway in. This is required
|
|
|
|
- The id of the subnet to create the NAT Gateway in. This is required
|
|
|
|
with the present option.
|
|
|
|
with the present option.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
allocation_id:
|
|
|
|
allocation_id:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The id of the elastic IP allocation. If this is not passed and the
|
|
|
|
- The id of the elastic IP allocation. If this is not passed and the
|
|
|
|
eip_address is not passed. An EIP is generated for this NAT Gateway.
|
|
|
|
eip_address is not passed. An EIP is generated for this NAT Gateway.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
eip_address:
|
|
|
|
eip_address:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- The elastic IP address of the EIP you want attached to this NAT Gateway.
|
|
|
|
- The elastic IP address of the EIP you want attached to this NAT Gateway.
|
|
|
|
If this is not passed and the allocation_id is not passed,
|
|
|
|
If this is not passed and the allocation_id is not passed,
|
|
|
|
an EIP is generated for this NAT Gateway.
|
|
|
|
an EIP is generated for this NAT Gateway.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
if_exist_do_not_create:
|
|
|
|
if_exist_do_not_create:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- if a NAT Gateway exists already in the subnet_id, then do not create a new one.
|
|
|
|
- if a NAT Gateway exists already in the subnet_id, then do not create a new one.
|
|
|
@ -53,22 +58,24 @@ options:
|
|
|
|
- Deallocate the EIP from the VPC.
|
|
|
|
- Deallocate the EIP from the VPC.
|
|
|
|
- Option is only valid with the absent state.
|
|
|
|
- Option is only valid with the absent state.
|
|
|
|
- You should use this with the wait option. Since you can not release an address while a delete operation is happening.
|
|
|
|
- You should use this with the wait option. Since you can not release an address while a delete operation is happening.
|
|
|
|
default: 'yes'
|
|
|
|
default: false
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
wait:
|
|
|
|
wait:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Wait for operation to complete before returning.
|
|
|
|
- Wait for operation to complete before returning.
|
|
|
|
default: 'no'
|
|
|
|
default: false
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
wait_timeout:
|
|
|
|
wait_timeout:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- How many seconds to wait for an operation to complete before timing out.
|
|
|
|
- How many seconds to wait for an operation to complete before timing out.
|
|
|
|
default: 300
|
|
|
|
default: 320
|
|
|
|
|
|
|
|
type: int
|
|
|
|
client_token:
|
|
|
|
client_token:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Optional unique token to be used during create to ensure idempotency.
|
|
|
|
- Optional unique token to be used during create to ensure idempotency.
|
|
|
|
When specifying this option, ensure you specify the eip_address parameter
|
|
|
|
When specifying this option, ensure you specify the eip_address parameter
|
|
|
|
as well otherwise any subsequent runs will fail.
|
|
|
|
as well otherwise any subsequent runs will fail.
|
|
|
|
|
|
|
|
type: str
|
|
|
|
author:
|
|
|
|
author:
|
|
|
|
- Allen Sanabria (@linuxdynasty)
|
|
|
|
- Allen Sanabria (@linuxdynasty)
|
|
|
|
- Jon Hadfield (@jonhadfield)
|
|
|
|
- Jon Hadfield (@jonhadfield)
|
|
|
@ -103,7 +110,7 @@ EXAMPLES = '''
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
subnet_id: subnet-12345678
|
|
|
|
subnet_id: subnet-12345678
|
|
|
|
eip_address: 52.1.1.1
|
|
|
|
eip_address: 52.1.1.1
|
|
|
|
wait: yes
|
|
|
|
wait: true
|
|
|
|
region: ap-southeast-2
|
|
|
|
region: ap-southeast-2
|
|
|
|
register: new_nat_gateway
|
|
|
|
register: new_nat_gateway
|
|
|
|
|
|
|
|
|
|
|
@ -111,7 +118,7 @@ EXAMPLES = '''
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
subnet_id: subnet-12345678
|
|
|
|
subnet_id: subnet-12345678
|
|
|
|
wait: yes
|
|
|
|
wait: true
|
|
|
|
region: ap-southeast-2
|
|
|
|
region: ap-southeast-2
|
|
|
|
register: new_nat_gateway
|
|
|
|
register: new_nat_gateway
|
|
|
|
|
|
|
|
|
|
|
@ -119,7 +126,7 @@ EXAMPLES = '''
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
subnet_id: subnet-12345678
|
|
|
|
subnet_id: subnet-12345678
|
|
|
|
wait: yes
|
|
|
|
wait: true
|
|
|
|
region: ap-southeast-2
|
|
|
|
region: ap-southeast-2
|
|
|
|
if_exist_do_not_create: true
|
|
|
|
if_exist_do_not_create: true
|
|
|
|
register: new_nat_gateway
|
|
|
|
register: new_nat_gateway
|
|
|
@ -128,9 +135,9 @@ EXAMPLES = '''
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
region: ap-southeast-2
|
|
|
|
region: ap-southeast-2
|
|
|
|
wait: yes
|
|
|
|
wait: true
|
|
|
|
nat_gateway_id: "{{ item.NatGatewayId }}"
|
|
|
|
nat_gateway_id: "{{ item.NatGatewayId }}"
|
|
|
|
release_eip: yes
|
|
|
|
release_eip: true
|
|
|
|
register: delete_nat_gateway_result
|
|
|
|
register: delete_nat_gateway_result
|
|
|
|
loop: "{{ gateways_to_remove.result }}"
|
|
|
|
loop: "{{ gateways_to_remove.result }}"
|
|
|
|
|
|
|
|
|
|
|
@ -138,7 +145,7 @@ EXAMPLES = '''
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
nat_gateway_id: nat-12345678
|
|
|
|
nat_gateway_id: nat-12345678
|
|
|
|
wait: yes
|
|
|
|
wait: true
|
|
|
|
wait_timeout: 500
|
|
|
|
wait_timeout: 500
|
|
|
|
region: ap-southeast-2
|
|
|
|
region: ap-southeast-2
|
|
|
|
|
|
|
|
|
|
|
@ -146,7 +153,7 @@ EXAMPLES = '''
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
ec2_vpc_nat_gateway:
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
nat_gateway_id: nat-12345678
|
|
|
|
nat_gateway_id: nat-12345678
|
|
|
|
release_eip: yes
|
|
|
|
release_eip: true
|
|
|
|
wait: yes
|
|
|
|
wait: yes
|
|
|
|
wait_timeout: 300
|
|
|
|
wait_timeout: 300
|
|
|
|
region: ap-southeast-2
|
|
|
|
region: ap-southeast-2
|
|
|
@ -447,7 +454,7 @@ def gateway_in_subnet_exists(client, subnet_id, allocation_id=None,
|
|
|
|
allocation_id_exists = False
|
|
|
|
allocation_id_exists = False
|
|
|
|
gateways = []
|
|
|
|
gateways = []
|
|
|
|
states = ['available', 'pending']
|
|
|
|
states = ['available', 'pending']
|
|
|
|
gws_retrieved, _, gws = (
|
|
|
|
gws_retrieved, err_msg, gws = (
|
|
|
|
get_nat_gateways(
|
|
|
|
get_nat_gateways(
|
|
|
|
client, subnet_id, states=states, check_mode=check_mode
|
|
|
|
client, subnet_id, states=states, check_mode=check_mode
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -874,7 +881,7 @@ def remove(client, nat_gateway_id, wait=False, wait_timeout=0,
|
|
|
|
results = list()
|
|
|
|
results = list()
|
|
|
|
states = ['pending', 'available']
|
|
|
|
states = ['pending', 'available']
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
exist, _, gw = (
|
|
|
|
exist, err_msg, gw = (
|
|
|
|
get_nat_gateways(
|
|
|
|
get_nat_gateways(
|
|
|
|
client, nat_gateway_id=nat_gateway_id,
|
|
|
|
client, nat_gateway_id=nat_gateway_id,
|
|
|
|
states=states, check_mode=check_mode
|
|
|
|
states=states, check_mode=check_mode
|
|
|
|