Next revision | Previous revisionNext revisionBoth sides next revision |
fuss:puppet [2020/06/26 04:22] – created office | fuss:puppet [2021/09/19 09:00] – [Extremely Quick Setup Guide for a Master and an Agent] office |
---|
| |
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. | 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. |
| |
| ====== Extremely Quick Setup Guide for a Master and an Agent ====== |
| |
| * install Puppet using the distribution package manager |
| * to set up a master: |
| * edit ''/etc/puppet/puppet.conf'' and: |
| * add ''server = myserver.tld'' to the ''[main]'' section (where ''myserver.tld'' represents the hostname of the current machine; of the master), |
| * add ''dns_alt_names = myserver.tld'' to the ''[master]'' section (where ''myserver.tld'' represents the hostname of the current machine; of the master), |
| * issue ''puppet config print | grep "^manifest ="'' in order to determine where the ''.pp'' files should go, |
| * add files to the directory, for instance ''site.pp'' |
| * issue ''puppet apply -t --verbose site.pp'' inside the manifest directory |
| * to set up an agent: |
| * edit ''/etc/puppet/puppet.conf'' and: |
| * add ''server = myserver.tld'' to the ''[main]'' section (where, ''myserver.tld'' represents the hostname of the Puppet master), |
| * issue ''puppet agent -t --verbose'' from anywhere to start provisioning the agent, |
| * issue ''puppet cert list'' on the master to show all pending certificates waiting to be signed, |
| * issue ''puppet cert sign AGENT'' on the master where ''AGENT'' is the configured agent, |
| * issue ''puppet agent -t --verbose'' from anywhere once again to start provisioning the agent. |
| |
| ====== Using Embedded Ruby to Conditionally Set Template Parameters ====== |
| |
| 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: |
| |
| <code> |
| <% if @fqdn == "media.internal" %> |
| net.ipv4.tcp_congestion_control=lp |
| <% else %> |
| net.ipv4.tcp_congestion_control=htcp |
| <% end %> |
| |
| </code> |
| |