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…
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.
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.
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.