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

How to identify which Puppet master was used in an agent run?

· 52CE 我爱测

I'm currently running multiple load-balanced masters and need to debug some differences between them. Is there a good way to include the hostname or some other ID of the puppet master in the agent reports? (Putting slightly diffe…

问题原文

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

I'm currently running multiple load-balanced masters and need to debug some differences between them.

Is there a good way to include the hostname or some other ID of the puppet master in the agent reports? (Putting slightly different code on each master is not an option for me)

已采纳解答

原帖链接 · Dominic Cleal · CC BY-SA 3.0

The Puppet master will inject variables such as $servername to the catalog compilation, which are listed at Puppet master variables.

You could include these in reports by using notify { "Compiled on $servername": } in one of your manifests, or adding it to a file template (e.g. MOTD).

Another mechanism would be to change the config_version - a unique name/number given to each catalog compilation, often used to show the current git/SCM revision of the manifests being built. By default it shows the current Unix epoch. You could change this to return the epoch and master hostname.

config_version is usually set per-environment, e.g. using environment.conf: config_version in environment.conf, and can point to a script that you deploy to every master and that outputs a string including the server's hostname.

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

资料来源与适用范围

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

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

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