# eos\_command module waitfor - IP address in json structure

**URL:** <https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946>\
**Category:** Ansible Project\
**Created:** [March 21, 2016, 4:29pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946 "2016-03-21T16:29:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Baro](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Martin\_Baro](https://forum.ansible.com/u/Martin_Baro)\
**Post date:** [March 21, 2016, 4:29pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/1 "2016-03-21T16:29:19Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![Uditha\_Desilva](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@Uditha\_Desilva](https://forum.ansible.com/u/Uditha_Desilva)\
**Post date:** [March 21, 2016, 5:07pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/2 "2016-03-21T17:07:43Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Martin\_Baro](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Martin\_Baro](https://forum.ansible.com/u/Martin_Baro)\
**Post date:** [March 21, 2016, 5:26pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/3 "2016-03-21T17:26:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Uditha\_Desilva](https://avatars.discourse-cdn.com/v4/letter/u/f475e1/32.png) [@Uditha\_Desilva](https://forum.ansible.com/u/Uditha_Desilva)\
**Post date:** [March 22, 2016, 1:50pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/4 "2016-03-22T13:50:04Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Martin\_Baro](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Martin\_Baro](https://forum.ansible.com/u/Martin_Baro)\
**Post date:** [March 22, 2016, 6:17pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/5 "2016-03-22T18:17:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [March 22, 2016, 8:25pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/6 "2016-03-22T20:25:24Z")

</div>

Thats a bug… could you file an issue at [github.com/ansible/ansible-modules-core](http://github.com/ansible/ansible-modules-core) please?

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [March 23, 2016, 6:39am UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/7 "2016-03-23T06:39:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [March 23, 2016, 6:40am UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/8 "2016-03-23T06:40:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Martin\_Baro](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Martin\_Baro](https://forum.ansible.com/u/Martin_Baro)\
**Post date:** [March 23, 2016, 7:41pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/9 "2016-03-23T19:41:14Z")

</div>

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

Martin

---

<div class="post-metadata">

**Author:** ![psprygada](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@psprygada](https://forum.ansible.com/u/psprygada)\
**Post date:** [March 23, 2016, 8:33pm UTC](https://forum.ansible.com/t/eos-command-module-waitfor-ip-address-in-json-structure/20946/10 "2016-03-23T20:33:04Z")

</div>

My pleasure, glad you found it helpful.
