On 08. juni 2017 17:05, Rod Oliver wrote:
Thanks for your respoinse Kai.

I changed the conditional statement to that below. It wasn't what I really
wanted but I figured if it worked I could build on it. I got a further
error.

Statement:
   when: int_stat.response | search(cdp_nei.response.item.neighbor)

Error:
TASK [Create interface description statements where needed]
************************************************************

fatal: [switch]: FAILED! => {"failed": true, "msg": "The conditional check
'int_stat.response | search(cdp_nei.respon
se.item.neighbor)' failed. The error was: error while evaluating
conditional (int_stat.response | search(cdp_nei.respons
e.item.neighbor)): 'list object' has no attribute 'item'\n\nThe error
appears to have been in '/home/vagrant/ansible/Aut
omation/cdp-description.yml': line 26, column 5, but may\nbe elsewhere in
the file depending on the exact syntax problem
.\n\nThe offending line appears to be:\n\n    register: int_stat\n  - name:
Create interface description statements wher
e needed\n    ^ here\n"}

The message says cdp_nei.response does not contain the attribute item.
So what is the content of cdp_nei.response?

- debug: var=cdp_nei.response

Will give you the content.



I tried to surround cdp_nei.response.item.neighbor with "" and got yet a
different error.

Statement:
   when: int_stat.response | search("cdp_nei.response.item.neighbor")

With "" it will be the literal string cdp_nei.response.item.neighbor and not the content of the variable.


I also suspect that int_stat.response and is not a string but a list. The search filter need a string.


--
Kai Stian Olstad

--
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/0f7bad06-b6c4-41a1-850f-c438e5bacc7c%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to