eos_command module waitfor - IP address in json structure

Hi

I`m trying to catch a specific route in the waitfor statment if it is present from a show ip route output.
However I think ansible misinterprets the statement because of the dots in the IP address.
(I can successfully test other values like vrfs.default.defaultRouteState )
The playbook:

The dotted form is a shorthand for using braces, so maybe this will work:

  • “result[0].vrfs.default.routes[‘{{ route }}’].hardwareProgrammed eq true”

Hi,

It seems it`s not evaluating the routes part:
with your waitfor:

ValueError: result[0].vrfs.default.routes[1.2.3.4/30].hardwareProgrammed

I also tried to index it with [0] without success:

ValueError: result[0].vrfs.default.routes[0].hardwareProgrammed

It may need more protection for those quotes – perhaps this?

  • “result[0].vrfs.default.routes['{{ route }}'].hardwareProgrammed eq true”

Hi Uditha,

Thanks for the reply.
I’ve simplified the problem a bit (just removed the variable) and with removing the “” around the whole statement I managed to preserve the quotes.
Unfortunately it didn’t solve the problem:

waitfor:

  • result[0].vrfs.default.routes['1.2.3.4/30'].hardwareProgrammed eq true

The error was: ValueError: result[0].vrfs.default.routes[‘1.2.3.4/30’].hardwareProgrammed

The issue is the same with double quotes around the IP address.

Thats a bug… could you file an issue at github.com/ansible/ansible-modules-core please?

Ignore the request for filing an issue, I committed a change that should fix this problem. The fix is available for testing in ansible/ansible devel

(ansible)[ansible-eos]$ cat route.yaml

Thanks Peter, much appreciated.
Also thanks for the great network webinar, was really informative.

Martin

My pleasure, glad you found it helpful.