
How to Configure Puppet Master and Agent
How to Configure Puppet Master and Agent
Puppet is a powerful configuration management tool used to automate the administration of servers. By setting up Puppet Master and Agent, you can ensure consistency and reliability across your infrastructure. This tutorial walks you through the configuration of a Puppet Master and Agent on Linux systems.
Prerequisites
- A server configured as Puppet Master running a supported Linux distribution
- At least one client system to act as a Puppet Agent
- Basic knowledge of Linux command line operations
Step 1: Install Puppet Master
First, you need to install Puppet Master on your server. Follow the steps below to get started:
sudo apt update
sudo apt install puppetserver
After installation, configure the Puppet Master by editing the /etc/puppetlabs/puppet/puppet.conf
file to define the hostname:
[master]
certname = puppetmaster.example.com
Start the Puppet Server with:
sudo systemctl start puppetserver
sudo systemctl enable puppetserver
Step 2: Configure Puppet Agent
On each node that will be managed by the Puppet Master, install the Puppet Agent:
sudo apt install puppet-agent
Edit the Puppet configuration file on each agent in /etc/puppetlabs/puppet/puppet.conf
:
[agent]
server = puppetmaster.example.com
Ensure the agent connects to the correct Puppet Master server by restarting the Puppet service:
sudo systemctl start puppet
sudo systemctl enable puppet
Step 3: Test the Configuration
To verify communication between the Puppet Master and the Agent, you can manually trigger a run of the Puppet Agent:
sudo puppet agent -t
You’ll see output indicating whether the agent successfully retrieved and applied configurations from the server.
Troubleshooting
If you encounter issues, check the following:
- Ensure network connectivity between master and agents.
- Verify DNS resolves correctly.
- Check logs at
/var/log/puppetlabs/puppetserver/puppetserver.log
for errors.
Summary Checklist
- Installed Puppet Master and Agent on respective servers.
- Configured
puppet.conf
for both Master and Agents. - Started and enabled Puppet services.
- Verified agent-master communication.
For further reading, check out our guide on creating Puppet manifests: How to Create Puppet Manifests: A Step-by-Step Guide.