使用Ansible处理程序滚动重启 [英] Rolling restart with ansible handlers

查看:185
本文介绍了使用Ansible处理程序滚动重启的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想运行一个安装了服务的ansible剧本,如果自上次运行以来有任何变化(或多或少的ansible处理程序的规范用例),则重新启动它.

I want to run an ansible playbook that installs a service and restarts it if anything has changed since the last run (more or less the canonical use-case for ansible handlers).

但是我希望安装时使用不同的并行性,而不是重新启动:我希望一次在所有主机上进行安装,但是,如果调用了"service-restart"处理程序,则希望它运行一次在X主机上.

But I want a different parallelism for installing than for restarting: I want to install on all the hosts at a time but, if the "service-restart" handler gets invoked I want that to run on X hosts at a time.

我知道这对于具有不同serial值的不同剧本是可能的.但是,如果走这条路,我看不到如何利用处理程序.而且我负担不起像2这样具有serial值的单个剧本,因为在大多数情况下,该服务不会改变.

I know this is possible with different plays that have different serial values. But I can't see how I could make use of handlers if I go this route. And I can't afford to have a single playbook with a serial value like 2, as most of the time nothing will change for that service.

处理程序可以跨多个游戏吗?还是没有其他方法可以做到这一点?

Can the handlers span multiple plays? Or is there any other way to do this without hacks?

推荐答案

当前不可能.为此,有一个问题.

Currently it's not possible. There is an issue oppened for this.

这篇关于使用Ansible处理程序滚动重启的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆