Some guides instruct the user to create a directory at /etc/puppet/manifests
and to place .pp
files in that directory. However, doing so results in a non-working puppet install since, by default, puppet has defined defaults.
The correct way is to determine the defaults and work with them. With Puppet installed, issue for instance:
puppet config print | grep manifest
and, at least on Debian, the output will be along the lines of:
default_manifest = ./manifests disable_per_environment_manifest = false genmanifest = false manifest = /etc/puppet/code/environments/production/manifests ordering = manifest
which means that .pp
files should be placed in /etc/puppet/code/environments/production/manifests
.
It is possible to edit /etc/puppet/puppet.conf
and change the defaults, however doing so comes at the cost of maintainability as well as possible incompatibility with the distribution defaults.
/etc/puppet/puppet.conf
and:server = myserver.tld
to the [main]
section (where myserver.tld
represents the hostname of the current machine; of the master),dns_alt_names = myserver.tld
to the [master]
section (where myserver.tld
represents the hostname of the current machine; of the master),puppet config print | grep "^manifest ="
in order to determine where the .pp
files should go,site.pp
puppet apply -t –verbose site.pp
inside the manifest directory/etc/puppet/puppet.conf
and:server = myserver.tld
to the [main]
section (where, myserver.tld
represents the hostname of the Puppet master),puppet agent -t –verbose
from anywhere to start provisioning the agent,puppet cert list
on the master to show all pending certificates waiting to be signed,puppet cert sign AGENT
on the master where AGENT
is the configured agent,puppet agent -t –verbose
from anywhere once again to start provisioning the agent.
As an example, assuming that a server is a dedicated seedbox machine, one would like to switch the TCP congestion protocol to lb
over htcp
or others. The following ERB template branches on the server FQDN and sets the TCP congestion protocol:
<% if @fqdn == "media.home" %> net.ipv4.tcp_congestion_control=lp <% else %> net.ipv4.tcp_congestion_control=htcp <% end %>