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
On Monday, March 21, 2016 at 6:07:43 PM UTC+1, Uditha Desilva wrote:
>
> 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/3c4b6fd3-b78d-482e-93ab-0ef7854d2b1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.