Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2_vpc_route_table not updating? #26664

Closed
willthames opened this issue Jul 12, 2017 · 13 comments
Closed

ec2_vpc_route_table not updating? #26664

willthames opened this issue Jul 12, 2017 · 13 comments
Labels
affects_2.3 This issue/PR affects Ansible v2.3 aws bug This issue/PR relates to a bug. cloud needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. support:core This issue/PR relates to code supported by the Ansible Engineering Team. waiting_on_maintainer This issue/PR requires input from the maintainer(s).

Comments

@willthames
Copy link
Contributor

From @mattgrahamdevops on February 15, 2016 23:21

Not sure if Im doing something wrong, but I can add the routes using ec2_vpc_route_table module but if I terminate the NAT instances that are in the routes (instance_id), you see the "black hole" in AWS GUI but for some reason when I go to run my playbook again, it creates new NAT's, gets the instance id's and then attempts to apply them to the route table but fails. If I manually go in and delete the "black hole" routes and run the playbook, its fine.

Version:

ansible 2.0.0.2

playbook code:

name: App Private Route Table 
ec2_vpc_route_table: 
  vpc_id: "{{ vpc_id }}" 
  region: "{{ aws_region }}" 
  subnets: "{{ item.subnet }}" 
  tags: Name: "{{ env | default('test') }}app_private{{ item.az }}" 
  routes: 
  - dest: 0.0.0.0/0 
  instance_id: "{{ item.instance }}" 
with_items: 
- { Name: app_a, subnet: "{{ cidr }}.5.0/24", instance: "{{ nat_servers.results[0].tagged_instances[0].id }}", az: a } 
- { Name: app_b, subnet: "{{ cidr }}.6.0/24", instance: "{{ nat_servers.results[1].tagged_instances[0].id }}", az: b }

Error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: argument of type 'NoneType' is not iterable
failed: [localhost] => (item={u'subnet': u'10.40.5.0/24', u'az': u'a', u'Name': u'app_a', u'instance': u'i-fddcfa22'}) => {"failed": true, "item": {"Name": "app_a", "az": "a", "instance": "i-fddcfa22", "subnet": "10.40.5.0/24"}, "parsed": false}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: argument of type 'NoneType' is not iterable
failed: [localhost] => (item={u'subnet': u'10.40.6.0/24', u'az': u'b', u'Name': u'app_b', u'instance': u'i-d6b1b908'}) => {"failed": true, "item": {"Name": "app_b", "az": "b", "instance": "i-d6b1b908", "subnet": "10.40.6.0/24"}, "parsed": false}

Current route table looks like:

0.0.0.0/0 eni-af3902c8 / i-3a0b2de5 Black Hole No

Copied from original issue: ansible/ansible-modules-extras#1674

@willthames willthames added affects_2.3 This issue/PR affects Ansible v2.3 aws bug_report cloud waiting_on_maintainer This issue/PR requires input from the maintainer(s). labels Jul 12, 2017
@willthames
Copy link
Contributor Author

From @ansibot on August 4, 2016 20:35

@erydo, @wimnat, ping. This issue is waiting on your response.
click here for bot help

@willthames
Copy link
Contributor Author

From @antoineco on August 31, 2016 16:45

I have a pretty much identical playbook and can confirm this is still happening on Ansible 2.1.1.0.

Ansible notifies about a change on the route table when the instance Id of the NAT instance has changed, but in fact nothing changes.

Playbook execution:

TASK [Provision bastion instance] **********************************************
[...]
changed: [localhost] =>
{
	"changed": true,
	"instance_ids": ["i-0891a50ddd61a7006"],
	"instances": [{
		"ami_launch_index": "0",
		"architecture": "x86_64",
		"block_device_mapping": {
			"/dev/xvda": {
				"delete_on_termination": true,
				"status": "attached",
				"volume_id": "vol-0c1554c87a29e950d"
			}
		},
		"dns_name": "ec2-52-57-28-154.eu-central-1.compute.amazonaws.com",
		"ebs_optimized": false,
		"groups": {
			"sg-2d87e344": "ssh-in"
		},
		"hypervisor": "xen",
		"id": "i-0891a50ddd61a7006",
		"image_id": "ami-ccc021a3",
		"instance_type": "t2.micro",
		"kernel": null,
		"key_name": "gini-dev",
		"launch_time": "2016-08-31T16:35:12.000Z",
		"placement": "eu-central-1a",
		"private_dns_name": "ip-172-31-33-124.eu-central-1.compute.internal",
		"private_ip": "172.31.33.124",
		"public_dns_name": "ec2-52-57-28-154.eu-central-1.compute.amazonaws.com",
		"public_ip": "52.57.28.154",
		"ramdisk": null,
		"region": "eu-central-1",
		"root_device_name": "/dev/xvda",
		"root_device_type": "ebs",
		"state": "running",
		"state_code": 16,
		"tags": {
			"Environment": "Internal",
			"Name": "bastion",
			"Role": "Bastion"
		},
		"tenancy": "default",
		"virtualization_type": "hvm"
	}],
	"invocation": {
		"module_args": {
			"assign_public_ip": true,
			"aws_access_key": null,
			"aws_secret_key": null,
			"count": 1,
			"count_tag": "{'Environment': 'Internal', 'Role': 'Bastion'}",
			"ebs_optimized": false,
			"ec2_url": null,
			"exact_count": 1,
			"group": ["ssh-in"],
			"group_id": null,
			"id": null,
			"image": "ami-ccc021a3",
			"instance_ids": null,
			"instance_profile_name": null,
			"instance_tags": {
				"Environment": "Internal",
				"Name": "bastion",
				"Role": "Bastion"
			},
			"instance_type": "t2.micro",
			"kernel": null,
			"key_name": "gini-dev",
			"monitoring": false,
			"network_interfaces": null,
			"placement_group": null,
			"private_ip": null,
			"profile": null,
			"ramdisk": null,
			"region": "eu-central-1",
			"security_token": null,
			"source_dest_check": false,
			"spot_launch_group": null,
			"spot_price": null,
			"spot_type": "one-time",
			"spot_wait_timeout": "600",
			"state": "present",
			"tenancy": "default",
			"termination_protection": false,
			"user_data": null,
			"validate_certs": true,
			"volumes": null,
			"vpc_subnet_id": "subnet-943debfc",
			"wait": true,
			"wait_timeout": "300",
			"zone": null
		},
		"module_name": "ec2"
	},
	"tagged_instances": [{
		"ami_launch_index": "0",
		"architecture": "x86_64",
		"block_device_mapping": {
			"/dev/xvda": {
				"delete_on_termination": true,
				"status": "attached",
				"volume_id": "vol-0c1554c87a29e950d"
			}
		},
		"dns_name": "ec2-52-57-28-154.eu-central-1.compute.amazonaws.com",
		"ebs_optimized": false,
		"groups": {
			"sg-2d87e344": "ssh-in"
		},
		"hypervisor": "xen",
		"id": "i-0891a50ddd61a7006",
		"image_id": "ami-ccc021a3",
		"instance_type": "t2.micro",
		"kernel": null,
		"key_name": "gini-dev",
		"launch_time": "2016-08-31T16:35:12.000Z",
		"placement": "eu-central-1a",
		"private_dns_name": "ip-172-31-33-124.eu-central-1.compute.internal",
		"private_ip": "172.31.33.124",
		"public_dns_name": "ec2-52-57-28-154.eu-central-1.compute.amazonaws.com",
		"public_ip": "52.57.28.154",
		"ramdisk": null,
		"region": "eu-central-1",
		"root_device_name": "/dev/xvda",
		"root_device_type": "ebs",
		"state": "running",
		"state_code": 16,
		"tags": {
			"Environment": "Internal",
			"Name": "bastion",
			"Role": "Bastion"
		},
		"tenancy": "default",
		"virtualization_type": "hvm"
	}]
}
TASK [Set up private subnet route table] ***************************************
[...]
changed: [localhost] =>
{
	"changed": true,
	"invocation": {
		"module_args": {
			"aws_access_key": null,
			"aws_secret_key": null,
			"ec2_url": null,
			"lookup": "tag",
			"profile": null,
			"propagating_vgw_ids": null,
			"region": "eu-central-1",
			"route_table_id": null,
			"routes": [{
				"destination_cidr_block": "0.0.0.0/0",
				"instance_id": "i-0891a50ddd61a7006"
			}],
			"security_token": null,
			"state": "present",
			"subnets": ["subnet-b103e4cb"],
			"tags": {
				"Environment": "Internal",
				"Name": "private"
			},
			"validate_certs": true,
			"vpc_id": "vpc-xxx"
		},
		"module_name": "ec2_vpc_route_table"
	},
	"route_table": {
		"id": "rtb-e720d08f",
		"routes": [{
			"destination_cidr_block": "172.31.0.0/16",
			"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": null,
			"instance_id": null,
			"interface_id": "eni-950925ff",
			"origin": "CreateRoute",
			"state": "blackhole",
			"vpc_peering_connection_id": null
		}],
		"tags": {
			"Environment": "Internal",
			"Name": "private"
		},
		"vpc_id": "vpc-xxx"
	}
}

Actual state of the route table:

{
    "RouteTables": [
        {
           [...]
            "Routes": [
                {
                    "GatewayId": "local", 
                    "DestinationCidrBlock": "172.31.0.0/16", 
                    "State": "active", 
                    "Origin": "CreateRouteTable"
                }, 
                {
                    "Origin": "CreateRoute", 
                    "DestinationCidrBlock": "0.0.0.0/0", 
                    "NetworkInterfaceId": "eni-950925ff", 
                    "State": "blackhole"
                }
            ]
        }
    ]
}

As the OP mentioned, deleting the black hole route leads to the expected result.

@willthames
Copy link
Contributor Author

From @ansibot on August 31, 2016 16:48

@erydo, @wimnat, ping. This issue is still waiting on your response.
click here for bot help

@willthames
Copy link
Contributor Author

From @aleric323 on October 5, 2016 18:46

Just ran into this, any progress?

@willthames
Copy link
Contributor Author

From @ansibot on October 5, 2016 19:14

@erydo, @wimnat, ping. This issue is still waiting on your response.
click here for bot help

@willthames
Copy link
Contributor Author

From @ansibot on October 21, 2016 8:55

@erydo, @wimnat, ping. This issue is still waiting on your response.
click here for bot help

@willthames
Copy link
Contributor Author

From @ansibot on November 6, 2016 10:55

@erydo, @wimnat, ping. This issue is still waiting on your response.
click here for bot help

@willthames
Copy link
Contributor Author

From @ansibot on November 22, 2016 11:2

@erydo, @wimnat, ping. This issue is still waiting on your response.
click here for bot help

@willthames
Copy link
Contributor Author

From @ansibot on December 7, 2016 15:52

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pull request to the ansible/ansible repo.

@willthames
Copy link
Contributor Author

From @ivanbaldo on July 10, 2017 15:31

Being bitten by this in Ansible 2.3.1.0.

@ansibot
Copy link
Contributor

ansibot commented Jul 12, 2017

@willthames Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • issue type
  • ansible version
  • component name

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md

click here for bot help

@ansibot ansibot added needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jul 12, 2017
@s-hertel
Copy link
Contributor

s-hertel commented Jul 27, 2017

@willthames Can you test if #27234 fixes this?

@ansibotdev
Copy link

@willthames You have not responded to information requests in this issue so we will assume it no longer affects you. If you are still interested in this, please create a new issue with the requested information.

click here for bot help

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 aws bug This issue/PR relates to a bug. cloud needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. support:core This issue/PR relates to code supported by the Ansible Engineering Team. waiting_on_maintainer This issue/PR requires input from the maintainer(s).
Projects
None yet
Development

No branches or pull requests

4 participants