ec2_vpc_route_table - how to configure a local route

87 views
Skip to first unread message

Gerald Preissler

unread,
Jul 5, 2021, 6:28:09 AM7/5/21
to Ansible Project
Hi, I'm trying to set up a VPC in AWS using Ansible. I'm running into a problem when I try to create a route table that should route packets to local. The following does not work:

- name: create route table for private subnets
  ec2_vpc_route_table:
     vpc_id: "{{ vpc_id }}"
     tags:
       Name: "{{ vpc_name }}-private"
     subnets:
     - "{{ vpc_subnet_ids['private-a'] }}"
     routes:
     - dest: 0.0.0.0/0
       gateway_id: "local"

This results in the error message "The gateway ID 'local' does not exist".

When I create the route table I want manually using the AWS Console and examine it with ec2_vpc_route_table_info, I get the following:

                "routes": [
                    {
                        "destination_cidr_block": "10.0.0.0/16",
                        "gateway_id": "local",
                        "instance_id": null,
                        "interface_id": null,
                        "network_interface_id": null,
                        "origin": "CreateRouteTable",
                        "state": "active"
                    },

My Google-Fu is too weak to find a solution, does anyone have any hints?

Gerald Preissler

unread,
Jul 6, 2021, 6:21:11 AM7/6/21
to Ansible Project


I noticed in the meantime that the RouteTable automatically contains a route to the local network so there is no need to create one specifically.

Komal Suthar

unread,
Jul 6, 2021, 7:12:06 AM7/6/21
to ansible...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/919ea151-e2dc-43e0-9419-1cdc43923a27n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages