Ansible Reload Cisco Devices Hangs



我有一个任务,重新加载一些思科路由器和思科防火墙。由于某种原因,剧本总是挂在这个任务后剧本已经重新加载了第一个设备。reload命令实际上被发送到第二个设备,我可以看到设备重新启动,但任务最终将失败。

输出:

Task [Reload Host Device]
fatal: [firewall2]: FAILED! => {"changed: false, "msg": "command timeout triggered, timeout value is 30 secs. nsee the timeout setting options in the Network Debug and Troubleshooting Guide."} ...ignoring

任务:

- name: Reload Host Device 
cli_command:
command: "reload"
prompt:
- "Proceed with reload?"
answer:
- "y"
ignore_errors: yes

根据给定的描述、任务和错误信息

command timeout triggered ... see the timeout setting options in the Network Debug and Troubleshooting Guide.

Ansible连接的设备将比Ansible更快地重新启动,模块cli_command可以保持自己的连接。即关闭并断开会话。

根据命令参考和思科路由器:自动重启在x秒,你可以尝试使用

- name: Schedule Host Device Reload in 1 min
cli_command:
command: "reload in 1"
prompt:
- "Proceed with reload?"
answer:
- "y"
register: result
- name: Show result
debug:
var: result

进一步阅读

过去用于Linux系统的另一种方法

  • 如何使用Ansible自动重启系统?

最新更新