Created
June 12, 2016 18:10
-
-
Save jonhadfield/64967ac919e2e020c020bc8cb7c23474 to your computer and use it in GitHub Desktop.
Test ec2_vpc_nat_gateway successes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Test VPC NAT Gateway Module | |
hosts: localhost | |
connection: local | |
gather_facts: False | |
tasks: | |
- name: create VPC NAT Gateway | |
ec2_vpc_nat_gateway: | |
state: present | |
subnet_id: "<you subnet id>" | |
allocation_id: "<eip allocation id 1>" | |
region: "<your region>" | |
register: nat_gateway_1 | |
- name: output nat gateway creation output | |
debug: var=nat_gateway_1 | |
- name: create a second VPC NAT Gateway in the same subnet where max count allows | |
ec2_vpc_nat_gateway: | |
state: present | |
subnet_id: "<you subnet id>" | |
allocation_id: "<eip allocation id 2>" | |
max_count: 2 | |
region: "<your region>" | |
register: nat_gateway_2 | |
# CHECK IDEMPOTENT | |
- name: Check VPC NAT Gateway 1 creation is idempotent | |
ec2_vpc_nat_gateway: | |
state: present | |
subnet_id: "<you subnet id>" | |
allocation_id: "<eip allocation id 1>" | |
max_count: 2 | |
register: nat_gateway_check | |
- name: output nat gateway creation output | |
debug: var=check_1 | |
- name: Check VPC NAT Gateway 2 creation is idempotent | |
ec2_vpc_nat_gateway: | |
state: present | |
subnet_id: "<you subnet id>" | |
allocation_id: "<eip allocation id 2>" | |
max_count: 2 | |
register: check_2 | |
- name: output nat gateway creation output | |
debug: var=nat_gateway_check | |
- name: Check VPC NAT Gateway 1 creation is idempotent 2 | |
ec2_vpc_nat_gateway: | |
state: present | |
subnet_id: "<you subnet id>" | |
allocation_id: "<eip allocation id 1>" | |
max_count: 2 | |
register: check_1_2 | |
- name: Check VPC NAT Gateway 2 creation is idempotent 2 | |
ec2_vpc_nat_gateway: | |
state: present | |
subnet_id: "<you subnet id>" | |
allocation_id: "<eip allocation id 2>" | |
max_count: 2 | |
register: check_2_2 | |
- name: delete VPC NAT Gateway 1 | |
ec2_vpc_nat_gateway: | |
state: absent | |
nat_gateway_id: "{{ check_1_2.nat_gateway_id }}" | |
register: nat_gateway_post_1 | |
- name: output nat gateway deletion output | |
debug: var=nat_gateway_post_1 | |
- name: delete VPC NAT Gateway 2 | |
ec2_vpc_nat_gateway: | |
state: absent | |
nat_gateway_id: "{{ check_2_2.nat_gateway_id }}" | |
# CHECK IDEMPOTENT | |
- name: Check VPC NAT Gateway deletion is idempotent | |
ec2_vpc_nat_gateway: | |
state: absent | |
nat_gateway_id: "{{ nat_gateway_post_1.nat_gateway_id }}" | |
register: nat_gateway_post | |
- name: output nat gateway deletion output | |
debug: var=nat_gateway_post |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment