Skip to content

Instantly share code, notes, and snippets.

@s-hertel
Created October 27, 2017 14:16
Show Gist options
  • Save s-hertel/bd3176bacc9afbe6c03a3e472fd9394b to your computer and use it in GitHub Desktop.
Save s-hertel/bd3176bacc9afbe6c03a3e472fd9394b to your computer and use it in GitHub Desktop.
---
- hosts: localhost
connection: local
gather_facts: no
tasks:
- name: create routing rules
ec2_vpc_route_table:
profile: shertel
vpc_id: "{{ vpc_id }}"
region: us-east-1
tags:
Name: "{{ tag }}"
routes:
- dest: 0.0.0.0/0
gateway_id: "{{ igw_id }}"
subnets:
- "{{ subnet }}"
Running once:
...
"route_table": {
"id": "rtb-46dfa43c",
"routes": [
{
"destination_cidr_block": "10.0.0.0/24",
"gateway_id": "local",
"instance_id": null,
"interface_id": null,
"origin": "CreateRouteTable",
"state": "active",
"vpc_peering_connection_id": null
}
],
"tags": {
...
PLAY RECAP ***************************************************************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=0
Running twice:
...
"route_table": {
"id": "rtb-46dfa43c",
"routes": [
{
"destination_cidr_block": "10.0.0.0/24",
"gateway_id": "local",
"instance_id": null,
"interface_id": null,
"origin": "CreateRouteTable",
"state": "active",
"vpc_peering_connection_id": null
},
{
"destination_cidr_block": "0.0.0.0/0",
"gateway_id": "igw-d57ed4ac",
"instance_id": null,
"interface_id": null,
"origin": "CreateRoute",
"state": "active",
"vpc_peering_connection_id": null
}
],
...
PLAY RECAP ***************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment