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

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

On Monday, 21 March 2016 16:56:35 UTC, Martin Baro wrote:
>
> 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:
> ---
>
> - name: test playbook
>   hosts: veos
>   gather_facts: no
>   connection: local
>   vars:
>    route: "1.2.3.4/30"
>   tasks:
>    - name: show ip route
>      eos_command:
>       commands:
>        - show ip route | json
>       username: ansible
>       password: ansible
>       host: x.x.x.x
>       transport: cli
>       waitfor:
>        - "result[0].vrfs.default.routes.{{ route }}.hardwareProgrammed eq 
> true"
>
> The error was: ValueError: 
> result[0].vrfs.default.routes.1.2.3.4/30.hardwareProgrammed
>
> The json structure is:
> "vrfs": {
>                     "default": {
>                         "allRoutesProgrammedHardware": true,
>                         "allRoutesProgrammedKernel": true,
>                         "defaultRouteState": "notSet",
>                         "routes": {
>                             "1.2.3.4/30": {
>                                 "directlyConnected": true,
>                                 "hardwareProgrammed": true,
>                                 "kernelProgrammed": true,
>                                 "routeAction": "forward",
>                                 "routeType": "connected",
>                                 "vias": [
>                                     {
>                                         "interface": "Ethernet2"
>                                     }
>                                 ]
>                             },
>                             "192.168.48.0/24": {
>                                 "directlyConnected": true,
>                                 "hardwareProgrammed": true,
>                                 "kernelProgrammed": true,
>                                 "routeAction": "forward",
>                                 "routeType": "connected",
>                                 "vias": [
>                                     {
>                                         "interface": "Ethernet1"
>                                     }
>                                 ]
>                             }
>
> Is there any way I can reference the specific route?
>
> Thanks,
>
> Martin
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6b74da0b-9b57-4b8d-a94c-3f453597de71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to