Thanks Igor.
You are right, it is not ansible "bug", but an configuration-feature, tough it is the "bad one" since it silently provides the false data. I had to dig into the source code to track it down.
There could be some warning in ec2_facts detecting default route, but it would be some work :/
---------------------
To sum up mine state - I've worked out the solution that is almost the same You have provided :)
I will describe it in my words:
I did not provide enough data about my subnets
I have public subnet, and a private one. Faulty instances were in the public subnet with their system-local-routeing table containing "default via 172.16.0.200 dev eth0"). I have moved that instances to private subnet, and set its routing table in the way, that the default traffic goes via NAT-instance in public subnet:
Destination
| Target
| Status
| Propagated
|
| local
| Active
| No
|
| eni-ezzzzb / i-2xxxx
| Active
| No
|
So that's exactly what You did stated :)
To fix the issue in the public subnet (with "default via 172.16.0.200 dev eth0"), it would be enough to add
ip r a 169.254.169.254 via 172.16.0.1
verification:
since the
modules/core/cloud/amazon/ec2_facts.py
defines the querry parameter as:
So I'll have to add 2xNAT and I'll be happy :)