# Cisco Router Configuration - match when description is \<word\> Conditional Check Failed

**URL:** <https://forum.ansible.com/t/cisco-router-configuration-match-when-description-is-word-conditional-check-failed/23926>\
**Category:** Ansible Project\
**Created:** [March 9, 2017, 7:26pm UTC](https://forum.ansible.com/t/cisco-router-configuration-match-when-description-is-word-conditional-check-failed/23926 "2017-03-09T19:26:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roger\_Perkin](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Roger\_Perkin](https://forum.ansible.com/u/Roger_Perkin)\
**Post date:** [March 9, 2017, 7:26pm UTC](https://forum.ansible.com/t/cisco-router-configuration-match-when-description-is-word-conditional-check-failed/23926/1 "2017-03-09T19:26:51Z")

</div>

I have written this play to run over a Cisco Router- then create a list of interfaces and the idea is to only apply a config to an interface based on the value or not of the descrption.

The play works fine up until the last point.

- block:
- name: write config to interface  
with\_indexed\_items: " {{ my\_list }} "  
ios\_config:  
lines: description CHANGED  
parents: GigabitEthernet{{ item.1 }}  
provider: “{{ cli }}”  
match: none  
**when: “’ description ANSIBLE’ in output.results[{{ item.0 }}].stdout\_lines”**

It just says **conditional check failed**

**skipping: [CSR-02] =\> (item=(1, u'GigabitEthernet2')) =\> { "changed": false, "item": [1, "GigabitEthernet2"], "skip\_reason": "Conditional check failed", "skipped": true**

All I want to do is for the interface that has a description of Ansible to perform a config change.

**What am I doing wrong?**

TASK [show output] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /etc/ansible/playbooks/skip\_int.yaml:36  
ok: [CSR-02] =\> (item=(1, u’GigabitEthernet2’)) =\> {  
“invocation”: {  
“module\_args”: {  
“var”: “output.results[1].stdout\_lines”  
},  
“module\_name”: “debug”  
},  
“item”: [  
1,  
“GigabitEthernet2”  
],  
“output.results[1].stdout\_lines”: [  
[  
“Building configuration…”,  
“”,  
“Current configuration : 69 bytes”,  
“!”,  
“interface GigabitEthernet2”,  
" ip address dhcp",  
" negotiation auto",  
“end”,  
“”  
]  
]  
}  
ok: [CSR-02] =\> (item=(0, u’GigabitEthernet1’)) =\> {  
“invocation”: {  
“module\_args”: {  
“var”: “output.results[0].stdout\_lines”  
},  
“module\_name”: “debug”  
},  
“item”: [  
0,  
“GigabitEthernet1”  
],  
“output.results[0].stdout\_lines”: [  
[  
“Building configuration…”,  
“”,  
“Current configuration : 98 bytes”,  
“!”,  
“interface GigabitEthernet1”,  
" description ANSIBLE",  
" no ip address",  
" shutdown",  
" negotiation auto",  
“end”,  
“”  
]  
]  
}  
ok: [CSR-02] =\> (item=(2, u’GigabitEthernet3’)) =\> {  
“invocation”: {  
“module\_args”: {  
“var”: “output.results[2].stdout\_lines”  
},  
“module\_name”: “debug”  
},  
“item”: [  
2,  
“GigabitEthernet3”  
],  
“output.results[2].stdout\_lines”: [  
[  
“Building configuration…”,  
“”,  
“Current configuration : 95 bytes”,  
“!”,  
“interface GigabitEthernet3”,  
" description test interface",  
" no ip address",  
" negotiation auto",  
“end”,  
“”  
]  
]  
}

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [March 10, 2017, 3:02pm UTC](https://forum.ansible.com/t/cisco-router-configuration-match-when-description-is-word-conditional-check-failed/23926/2 "2017-03-10T15:02:36Z")

</div>

Don't use curly brackets in when:, they are implied.  
If you do you can get all kind of strange behavior.

when: "' description ANSIBLE' in output.results[item.0].stdout\_lines"

---

<div class="post-metadata">

**Author:** ![Roger\_Perkin](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Roger\_Perkin](https://forum.ansible.com/u/Roger_Perkin)\
**Post date:** [March 10, 2017, 9:08pm UTC](https://forum.ansible.com/t/cisco-router-configuration-match-when-description-is-word-conditional-check-failed/23926/3 "2017-03-10T21:08:15Z")

</div>

Thanks, tried that but it still skips the conditional check.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [March 10, 2017, 10:19pm UTC](https://forum.ansible.com/t/cisco-router-configuration-match-when-description-is-word-conditional-check-failed/23926/4 "2017-03-10T22:19:11Z")

</div>

After checking the variable output I see that the  
output.results[item.0].stdout\_lines  
contains a list of lists so you need to use

output.results[item.0].stdout\_lines.0
