#151: Set up the puppetmaster - Rmhibbert/oe2-group-c GitHub Wiki

Set up the puppetmaster

Step by step

Add the puppet repository

Description: Add the puppetmaster in the repository

Command:

  • wget https://apt.puppetlabs.com/puppet7-release-jammy.deb
  • sudo dpkg -i puppet7-release-jammy.deb
  • sudo apt update

Install package server for Puppet

Description: Install the puppet server package

Command: sudo apt install puppetserver -y


Configure the Puppet server

Description: Edit the Puppet server configuration file. This is the file path /etc/puppetlabs/puppet/puppet.conf

Command: sudo nano puppet.conf


Edit the puppet.conf file

Description: Added the certname, server, and runinterval into the puppet.conf

Command:

  • [main]
  • certname = mgmt-c.oe2.org.nz
  • server = mgmt-c
  • runinterval = 1h

Added a file into this directory. This is the file path /etc/puppetlabs/code/environments/production/manifests/

Description: Move your directory to that file path and create a file called site.pp in the directory

Command: sudo nano site.pp


Open the Puppet Server Configuration File

Description: The Puppet Server uses Java Virtual Machine (JVM) memory settings, which can be adjusted for better performance. The configuration file is located at /etc/default/puppetserver.

Command: sudo nano /etc/default/puppetserver


Modify JVM Memory Limits

Description: Edit the $JAVA_ARGS line to set the minimum (-Xms) and maximum (-Xmx) heap size for the Puppet Server.

Command: JAVA_ARGS="-Xms2g -Xmx2g" image


Restart puppetmaster

Description: Apply the changes by restarting the Puppet Server.

Command: sudo systemctl restart puppetserver


Start and enable the puppetmaster server

Description: Ensure the Puppet Server starts on boot and is currently running.

Command:

  • sudo systemctl start puppetserver
  • sudo systemctl enable puppetserver

Verify Puppet Server Status

Description: Check if the Puppet Server is running properly.

Command: sudo systemctl status puppetserver


Test the Puppet Agent on the Master Server

Description: By default, the Puppet master also has a Puppet agent installed. This allows it to manage itself as a node, just like any other agent in your Puppet infrastructure.

Command: sudo puppet agent --test


Regenerating certificates in a Puppet deployment

Description: If the agent test have an error occur when try to run the test. Follow this documentation for regenerating the CA

Link: https://www.puppet.com/docs/puppet/7/ssl_regenerate_certificates.html


Challenges

None