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"}

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")

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

fatal: [switch]: FAILED! => {"failed": true, "msg": "The conditional check 
'int_stat.response | search(\"cdp_nei.resp
onse.item.neighbor\")' failed. The error was: Unexpected templating type 
error occurred on ({% if int_stat.response | se
arch(\"cdp_nei.response.item.neighbor\") %} True {% else %} False {% endif 
%}): expected string or buffer\n\nThe error a
ppears to have been in 
'/home/vagrant/ansible/Automation/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  - n
ame: Create interface description statements where needed\n    ^ here\n"}

-- 
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/85ac3eec-e566-4213-92b1-c9b47d171ea2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to