Skip to content

Commit f81ba54

Browse files
committed
Add puppet_server fact to return agent's server
It is frequently useful to configure an agent to retrieve a resource from it's configured master, or make further configuration adjustments to itself based on what server it's using. Similar to the rationale for stdlib providing a puppet_vardir fact, this commit adds a puppet_server fact. Note that the closest equivalent available today is $settings::server, which returns only the MASTER's configured server, not the AGENT's. This makes $settings::server unreliable, and not useful in a multi-master deployment or a deployment involving a load balancer.
1 parent dcef77a commit f81ba54

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/facter/puppet_settings.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,11 @@
3333
end
3434
end
3535
end
36+
37+
Facter.add(:puppet_server) do
38+
setcode do
39+
Facter::Util::PuppetSettings.with_puppet do
40+
Puppet[:server]
41+
end
42+
end
43+
end

0 commit comments

Comments
 (0)