When working with Puppet on CentOS, you'll encounter two distinct components: the Puppet master (server) and Puppet agent (client). The version checking methods differ slightly between these components due to their different execution contexts.
The modern approach uses the unified Puppet command with subcommands:
# For systemd systems (CentOS 7+):
sudo puppet master --version
# For older init.d systems:
sudo /usr/sbin/puppetmasterd --version
If these commands fail, try locating the binary directly:
# Find the puppet master binary location
sudo find / -name puppetmasterd 2>/dev/null
# Then check version
/usr/sbin/puppetmasterd --version
The agent version is typically easier to check:
puppet agent --version
For comprehensive version information including dependencies:
puppet agent --version --verbose
When direct commands aren't available, try these approaches:
1. RPM Query (for package installations):
rpm -q puppet
rpm -q puppet-server
2. Ruby Gem Verification:
gem list puppet
3. Puppet Apply Version:
puppet apply --version
Command Not Found Errors: Ensure Puppet is in your PATH or use full paths:
/opt/puppetlabs/bin/puppet --version
Permission Denied: Either use sudo or check your PATH environment variable:
echo $PATH
which puppet
Here's how to programmatically compare versions in a shell script:
REQUIRED_VERSION="6.25.0"
CURRENT_VERSION=$(puppet agent --version)
if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$CURRENT_VERSION" | sort -V | head -n1)" = "$REQUIRED_VERSION" ]; then
echo "Version $CURRENT_VERSION meets requirements"
else
echo "Version $CURRENT_VERSION is lower than required $REQUIRED_VERSION"
fi
Remember that version checking approaches may vary slightly between Puppet Open Source and Puppet Enterprise installations.
When working with Puppet on CentOS, you'll notice some naming inconsistencies in the binaries. The traditional puppetmaster
service name in /etc/init.d
differs from the modern puppet-master
command that appears in documentation. This stems from Puppet's evolution across versions.
The universal way to check any Puppet component version is using the base puppet
command:
# For the Puppet agent version:
$ puppet --version
6.23.0
# For detailed version information (including all components):
$ puppet version
If you need to check specific components separately:
# Puppet Server (modern master):
$ puppetserver --version
puppetserver version: 2.7.2
# Facter version (system inventory tool):
$ facter --version
3.14.12
On CentOS/RHEL systems, you can also check via the package manager:
$ rpm -qa | grep puppet
puppet-agent-6.23.0-1.el7.x86_64
puppet-release-1.0.0-2.el7.noarch
$ yum info puppet-agent
To check running services and their versions:
$ systemctl status puppet
$ systemctl status puppetserver # For modern Puppet Server
If commands aren't found, check your PATH or installation:
# Find where Puppet is installed:
$ find /opt/puppetlabs/bin -name "puppet*"
# Alternative PATH setting:
export PATH=/opt/puppetlabs/bin:$PATH
When verifying versions, note these compatibility guidelines:
- Agent versions should match or be one minor version behind the master
- Puppet 5.x and 6.x have different upgrade paths
- Facter 3.x is required for Puppet 5+