首页 > 解决方案 > Ansible - 减少屏幕输出

问题描述

我的剧本中有以下任务,它会在屏幕上生成大量输出。有没有办法隐藏这些行(例如ok: [LAB_RT03] => (item=show runn)在屏幕上?文件中的项目是在网络设备上运行的显示命令列表。实际上将有 10 条命令。

任务

- name: "retrieve show commands  from Routers "
 ios_command:
   commands: 
   - command: "{{ item }}"
 loop: "{{ lookup('file', './commands/ios_commands.txt').splitlines() }}"
 register: ios_output
 ignore_errors: true
 when: ansible_network_os == 'ios'

输出:

ok: [LAB_RT03] => (item=show runn)
ok: [LAB_RT04] => (item=show runn)
ok: [LAB_RT04] => (item=show version)
ok: [LAB_RT03] => (item=show version)
ok: [LAB_RT04] => (item=show ip route vrf ext)
ok: [LAB_RT03] => (item=show ip route vrf ext)

标签: ansiblecisco-ios

解决方案


推荐阅读