I've a playbook with telnet module
- name: run commands over Telnet
hosts: myhosts
gather_facts: False
strategy: free
tasks:
- name: switch show
ansible.netcommon.telnet:
user: user
password: pass
login_prompt: 'sername'
password_prompt: 'assword'
prompts:
- '[>#]'
command:
- disable clipaging
- disable clipaging
#- somethere
#
register: results
- name: debug results
debug:
msg: "{{ results }}"
The debug of result is
{
"msg": {
"changed": true,
"failed": false,
"output": [
" disable clipaging\r\nCommand: disable clipaging\r\n\r\nSuccess.\r\n\rn116-c8-acc7:5#",
" disable clipaging\r\nCommand: disable clipaging\r\n\r\nSuccess.\r\n\rn116-c8-acc7:5#"
]
}
}
How to check the output list in such a way, that if all items contain a "Success" substring, then the playbook is considered to be successfully completed, otherwise failed?
My current solution: