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": trueAll 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",
""
]
]
}
--
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/9ebdd5a0-0281-4b5b-8fdf-52742b241400%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.