我有一个Ansible操作手册,用于自动备份服务器和数据库(都在同一个虚拟机上)。
昨天晚上,在剧本运行的中间,rsync遇到了主机不可达错误,剧本失败。 我不知道在主机无法访问的情况下,块的“救援”部分将不会执行。 这导致救援不能运行,我们备份的服务没有上线,这意味着许多人在上午无法工作。
我正在寻找一种方法来捕获主机无法访问的错误,如“failed_when”,这样我就可以执行任务来启动服务,以避免再次发生这种情况。
有没有人有任何想法?
I have an Ansible playbook that is used to automate the backup of a server and database (both on the same VM).
Last night during the middle of the playbook's run, rsync ran into a host unreachable error and the playbook failed. I was unaware that the "rescue" part of the blocks will not be executed in the case of a host unreachable. This caused the rescue to not be run and the service we were backing up did not come online, meaning that many people were unable to do work in the morning.
I'm looking for a way to catch the host unreachable error within something like a "failed_when" so that I can execute a task to start the service in the off chance that this happens again.
Does anyone have any ideas?
最满意答案
截至目前,Ansible无法实现。 这是一个已知的问题 。
As of right now this is not possible with Ansible. It is a known issue.
更多推荐
发布评论