When I tried to create a route table via my playbook, two route tables were created. The main route table has 0 explicitly associated subnets while all the three subnets in this case are associated with the route table marked as not the main route table. However, this none main route table is actually the one that I expected to create since it has the names/tags that I specified in the script.
How can I create only one route table (my-private-route-table in this case) and make it the main one (prevent the other one from being created)? Here is a snippet of the code:
- name: Set up my route table
register: my_route_table
local_action:
module: ec2_vpc_route_table
vpc_id: “{{ my_vpc_facts[ ‘vpcs’ ] [ 0 ] [ ‘id’ ] }}”
region: “{{ region }}”
resource_tags:
Name: “my-private-route-table”
subnets: - “{{ my_subnet_1[‘subnet’][‘id’] }}”
- “{{ my_subnet_2[‘subnet’][‘id’] }}”
- “{{ my_subnet_3[‘subnet’][‘id’] }}”
routes: - dest: 192.168.10.0/24
My Ansible version is 2.3.1.0 with Python 2.7.10 running on a MAC. Can someone please help? Thanks in advance!