Unable to use ec2_vpc_route_table to remove route tables.... anyone else?

262 views
Skip to first unread message

rc....@gmail.com

unread,
Dec 7, 2016, 3:43:57 PM12/7/16
to Ansible Project
Using version:

ansible 2.2.1.0 (stable-2.2 acad2ba246) last updated 2016/12/07 11:28:43 (GMT -400)
  lib/ansible/modules/core: (detached HEAD 8139278530) last updated 2016/12/07 11:28:55 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD f5f1fc934a) last updated 2016/12/07 11:28:56 (GMT -400)
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

I'm able to build route tables just fine, but trying to utilize the "state:absent" attribute in the module does not result in removing route tables. 

I ended up doing a shell task and calling awscli to handle the removal. I don't see any specific issues on the extras Github site about this behavior, so I thought I'd inquire here... 

Thanks,

--rc

Igor Cicimov

unread,
Dec 13, 2016, 5:43:52 PM12/13/16
to Ansible Project
Just to clarify, was the routing table in use by a subnet(s) at that moment? I think AWS will not allow you to remove a resource that is referenced by another one.

Rick Crelia

unread,
Dec 15, 2016, 12:19:25 PM12/15/16
to Ansible Project
Not that I could see, since I delete the subnets prior to this step. The only other VPC resource at this point in the play is an Internet Gateway, but if I try to remove it before the route tables, I get an error (because of what you describe, a resource reference).  

I haven't had time to test a simpler version of the role/play (it's tearing down a VPC with NAT Gateways) to get more info, but I have some now so I'll tinker on it some more before filing a bug report.

Thanks,

--rc

Rick Crelia

unread,
Dec 15, 2016, 12:19:38 PM12/15/16
to Ansible Project
So it turns out that you have to specify the lookup attribute when trying to delete the route table by route_table_id. Once I add "lookup: id" to the invocation, the deletion works. This isn't called out in the module documentation, so I'll suggest that change to the module docs.

Thanks!

--rc

On Tuesday, December 13, 2016 at 5:43:52 PM UTC-5, Igor Cicimov wrote:
Reply all
Reply to author
Forward
0 new messages