Getting files from the fileserver without knowing its name

07 August 2006

Puppet stores configuration files for all its clients on a central fileserver, which by default is the same as the puppetmaster. If a manifest needs to refer to a file on the fileserver without knowing the hostname of the puppetmaster explicitly, it can use the variable $servername in the manifest, which is set to the hostname of the puppetmaster. That means that writing

file { "/etc/somefile": 
  source => "puppet://$servername/config/somefile" 
}

will work regardless of the name of the puppetmaster. All it requires is that the fileserver runs on the same host as the puppetmaster, and that it has a module config. This is very helpful in writing portable manifests.

Creative Commons License Watzmann.Blog by David Lutterkort is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

Generated with Jekyll