I'm using puppet to configure servers. I want to print current machine (node) name in *.erb template. There is hostname variable, but this holds puppetmaster hostname. Is there any good reference/list regarding to this topic?
The Puppet Server service name is puppetserver . To start and stop the service, use commands such as service puppetserver restart , service puppetserver status for your OS.
A node definition, also known as a node statement, is a block of Puppet code that is included only in matching nodes' catalogs. This allows you to assign specific configurations to specific nodes. Put node definitions in the main manifest, which can be a single site. pp file, or a directory containing many files.
The puppet. conf file is always located at $confdir/puppet. conf . Although its location is configurable with the config setting, it can be set only on the command line.
The Puppet site manifest (site. pp) is the main file that Puppet uses to define global system configuration.
Seems like I have miss-looked somewhere. I can get(print) node-hostname simply by invoking following code in *.erb template:
<%= @hostname %>
Edit: As of Puppet 3, using local variables (i.e. hostname
is deprecated; Puppet 4 will remove support for them entirely. The recommended way is to use instance variables (prefixed with @
. So in this case, @hostname
. Source
Entering the following command into your terminal will return variables available in your erb files:
facter --puppet
Yes to all the above; you may also find the fqdn
variable useful, depending on what you're up to.
If you DO find yourself needing the puppet master server's info in a template, you can use the variables servername
, serverip
, and serverversion
(From the Puppet docs).
Apparently you can now use
<%= fqdn %>
and get the DNS reverse name.
If you need to lowercase it, use
<%= fqdn.downcase %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With