
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 09:43 PM
Hello,
I am working on a Metric check list including show commands.
Some of those commands provide output with a delay or even require to hit "enter" to scroll further down.
I was wondering, what the best approach would be to tackle this issue.
Not sure if the following module would be the proper approach:
ansible.builtin.wait_for module
Thanks,
Solved! Go to Solution.
- Labels:
-
Code Exchange Platform
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 10:52 PM
Ok, I think I solved it by also changig the timeout.
Now, Ansible is waiting until command output and captures the whole output of " show version installed"
# Example – show version installed on Cisco Cat9k
---
- name: Ansible site-ios-xe-L2-L3-Metrics-Check-IDF_@M.Wolf_Jan2024
hosts: MTIDFiosxe
vars_files:
- /home/wolfm/Ansible/vault_password.yml
vars:
ansible_become_pass: "{{ vault_sudo_password }}"
ansible_python_interpreter: /usr/bin/python3
ansible_command_timeout: 120
- name: Task30 sh version installed
ios_command:
commands: sh version installed
wait_for: result[0] contains Provisioning File
:
- name: Task30 sh version install install after upgrade
debug:
var: output30
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2024 10:15 AM
Yes, an example
- name: Run show version and check to see if output contains IOS cisco.ios.ios_command: commands: show version wait_for: result[0] contains IOS
Please mark it as Helpful and/or Solution Accepted if that is the case. Thanks for making Engineering easy again.
Connect with me for more on Linkedin https://www.linkedin.com/in/rubencocheno/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 09:39 PM
Thank you Ruben.
There is one more challenge.
If show command requires to hit enter for "more".
For example "sh version installed" requires to hit more to scroll down.
Please advise.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2024 10:52 PM
Ok, I think I solved it by also changig the timeout.
Now, Ansible is waiting until command output and captures the whole output of " show version installed"
# Example – show version installed on Cisco Cat9k
---
- name: Ansible site-ios-xe-L2-L3-Metrics-Check-IDF_@M.Wolf_Jan2024
hosts: MTIDFiosxe
vars_files:
- /home/wolfm/Ansible/vault_password.yml
vars:
ansible_become_pass: "{{ vault_sudo_password }}"
ansible_python_interpreter: /usr/bin/python3
ansible_command_timeout: 120
- name: Task30 sh version installed
ios_command:
commands: sh version installed
wait_for: result[0] contains Provisioning File
:
- name: Task30 sh version install install after upgrade
debug:
var: output30
