What I Did
I wanted to try Puppet without dedicating two full VMs. I ran a Puppet master and agent in separate Ubuntu Docker containers on my machine. Docker host commands work the same on Ubuntu and Arch.
Installing Puppet Master
Download the Ubuntu image:
sudo docker pull ubuntuCreate a container for Puppet master:
sudo docker run --name puppet-master -it ubuntu exitStart the container:
sudo docker start puppet-masterOpen the bash shell of the Puppet master container:
sudo docker exec -it puppet-master bashUpdate and upgrade the container:
apt update apt upgradeInstall necessary tools:
apt install nano inetutils-ping net-tools wget -yAdd the Puppet repository:
wget https://apt.puppetlabs.com/puppet7-release-focal.deb dpkg -i puppet7-release-focal.deb apt updateCreate an image of the configured container:
exit sudo docker commit puppet-master puppet-7Confirm the image creation:
sudo docker imagesInstall Puppet server:
sudo docker exec -it puppet-master bash apt install puppetserverModify memory allocation for Java in Puppet server configuration:
nano /etc/default/puppetserverReplace:
JAVA_ARGS="-Xms2g -Xmx2g"With:
JAVA_ARGS="-Xms64m -Xmx512m"Create a certificate authority:
/opt/puppetlabs/bin/puppetserver ca setupStart the Puppet server:
service puppetserver startAdd Puppet to the system path:
echo 'PATH=$PATH:/opt/puppetlabs/bin' >> ~/.bashrc source ~/.bashrcRetrieve the fully qualified domain name (FQDN):
facter -p | grep fqdn
Installing the Puppet Agent
Create a container for the Puppet agent using the previously created image:
sudo docker run --name puppet-agent -it puppet-7 exitStart the Puppet agent container:
sudo docker start puppet-agentOpen the bash shell of the Puppet agent container:
sudo docker exec -it puppet-agent bashInstall Puppet agent:
apt install puppet-agentAdd Puppet to the system path:
echo 'PATH=$PATH:/opt/puppetlabs/bin' >> ~/.bashrc source ~/.bashrc
Configuring Puppet Master and Puppet Agent
Configuring the Puppet Agent
Edit the hosts file:
nano /etc/hostsAdd the IP address of the Puppet master container along with its FQDN.
Check the connection:
ping <your fqdn>
Configuring the Puppet Master
Sign certificates of all agents:
nano /etc/puppetlabs/puppet/puppet.confAdd the following line:
autosign=true service puppetserver restartVerify the connection:
puppet agent --test --server <fqdn>
If the connection is established successfully, the output should indicate no errors.