问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
