大网数据广告活动
服务器运维问答

How to make puppet to start all services in the end of the catalogue run?

· 52CE 我爱测

Especially when setting up a completely new server from the scratch, puppet tends to start dependant services as soon as all their dependencies are satisfied. This sometimes leads to situation that services are started unnecessar…

问题原文

原帖链接 · Ville Mattila · CC BY-SA 3.0

Especially when setting up a completely new server from the scratch, puppet tends to start dependant services as soon as all their dependencies are satisfied. This sometimes leads to situation that services are started unnecessarily too early while the setup of other packages (not maybe dependant of a service) is still running.

Is there any one-liner definition or recipe that would automatically make all services to start/refresh in the end of the whole catalogue run? I tried to figure out if run stages could be utilized but that would, in my understanding, require that all service definitions are explicitly defined to "last" stage.


Update 1: Some background to my question. Puppet, during the initial setup of a node, works rather intensively and thus reserves resources of a fairly small virtual machine (in my case, Vagrant on dev machine). When the setup phase came to a point that some of the services, in my case the background workers, were ready, Puppet starts them and the workers start to receive jobs from a queue. This workload slows down the still-going-on Puppet node setup process as well as the Puppet slows down the workers, until the whole setup is done and the box is in a stable state.

This is why I started to think that it would be good to let Puppet to work the initial setup to its end before all services on the node are started and why I was wondering whether there is any simple way to do this with Puppet.

社区高分解答

原帖链接 · dmourati · CC BY-SA 3.0

I would advise against a global restart. Rather, use puppet dependencies.

Something like:

service { 'first':
      ensure    => running,
      enable    => true,
    }

service { 'second':
      ensure    => running,
      enable    => true,
      subscribe => Service['first']
}

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-12-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。