This role is able to create any number of NAT gateways per VPC and per subnet.
- Ansible 2.5
Additional variables that can be used (either as host_vars
/group_vars
or via command line args):
Variable | Description |
---|---|
aws_vpc_nat_profile |
Boto profile name to be used |
aws_vpc_nat_default_region |
Default region to use |
aws_vpc_nat_eip_filter_additional |
Additional key val filter to add to eip_filter and eip_name by default |
aws_vpc_nat_subnet_filter_additional |
Additional key val filter to add to subnet_filter and subnet_name by default |
When using the sane defaults, the only thing to configure for each nat gateway is:
- either the
subnet_filter
to find one unique subnet by filter (tags, ids, etc) - or the
subnet_name
to find one unique subnet by name
aws_vpc_nat_gateway:
# Add Nat GW to a subnet found by filter and create EIP automatically
- name: natgw-1
subnet_filter:
- key: "tag:Name"
val: "sn-1"
# Add Nat GW to a subnet found by name and create EIP automatically
- name: natgw-2
subnet_name: sn-2
Instead of using somebody's sane defaults, you can also add tags for each nat gateway.
# Ensure subnet filter (name or filter)
# includes that their state is already created. (not pending nor deleted)
aws_vpc_nat_eip_filter_additional:
- key: state
val: available
# Ensure EIP filter (name or filter)
# includes that their owned by a vpc
aws_vpc_nat_subnet_filter_additional:
- key: domain
val: vpc
aws_vpc_nat_gateway:
# Add Nat GW to a subnet found by filter
- name: natgw-1
subnet_filter:
- key: "tag:Name"
val: "sn-1"
# re-use existing EIP found by filter
eip_flter:
- key: "tag:Name"
val: "eip-1"
tags:
- key: env
val: production
region: eu-central-1
# Add Nat GW to a subnet found by name
- name: natgw-2
subnet_name: sn-2
# re-use existing EIP found by name
eip_name: eip-2
tags:
- key: env
val: testing
- Docker
- yamllint
# Lint the source files
make lint
# Run integration tests with default Ansible version
make test
# Run integration tests with custom Ansible version
make test ANSIBLE_VERSION=2.4