Introduction
Besides managing servers, Puppet performs other paramount functions that have led to its popularity. Whether it be dynamic scaling up and scaling down of machines, facilitating central modifications, or providing unique configuration to every user, Puppet does it all. It has automated several complex perks of building a project that requires skilled understanding and complex codes.
To get started with Puppet, visit Installing and Configuring Puppet Enterprise.

In this article, we will discuss Puppet's Upgradation concept and its various aspects in detail.

Must Recommended Topic, Types of Agents in Artificial Intelligence.
Upgradation Concept in Puppet
As the name suggests, the upgradation concept will deal with the upgradation of every aspect of Puppet. This includes its infrastructure components, agents, and nodes. The precedence in which you upgrade the components is important.

PuppetServer and PuppetDB are upgraded parallelly along with the puppetdb-termini package on Puppet Server nodes. These components are always upgraded before you upgrade agent nodes. Ensure that you do not run different major versions on your Puppet primary servers and PuppetDB nodes. It may lead to errors.
Note that you have to restart the puppetserver every time you upgrade the puppet-agent package. Now, we will discuss each of these components sequentially in detail.
Upgrade PuppetServer
A user always has the option to add newer features and functionalities by upgrading puppetserver packages. Upgrading puppetserver packages successfully can upgrade the Puppet Server automatically. The puppetserver package is dependent on the puppet-agent package. So, the node’s package manager automatically upgrades puppet-agent in case the new version of the puppetserver requires it.

Note that during upgradation, the puppet server does not perform its general activities. So, if you have a single primary server, plan the timing of your upgrade accordingly. During that time, avoid reconfiguring any managed servers until your primary server is backed up. If you are using multiple servers, update them separately to avoid issues.
To upgrade the PuppetServer, follow these steps.
1. Run the following command on the Puppet Server node of your package installer.
Yum:
yum update puppetserver
Apt:
apt-get update
apt-get install --only-upgrade puppetserver
2. Remove those pins if you have used pins to mark Puppet packages to a specific version.
Yum:
Edit /etc/yum/pluginconf.d/versionlock.list to remove the lock for yum packages locked with the versionlock plugin.
Apt:
Remove .pref files from /etc/apt/preferences.d/ that are responsible for pinning packages. Use the apt-mark unhold command on each of these packages for apt systems.
3. After you have completed upgrading the puppet-agent package, ensure to restart the puppetserver service.
Upgrade PuppetDB
To get the newest functionalities available, we upgrade the PuppetDB.

Follow these steps to complete the upgradation.
1. There are two ways in which you can upgrade PuppetDB, that are, automatic upgradation or manual upgradation.
For automatic upgradation, add the value to the version parameter of puppetlabs/puppetdb module. This module exists in the puppetdb::globals class.
For manual upgradation, run the following command in the package installer of the PuppetDB node.
Yum:
yum update puppetdb
Apt:
apt-get update
apt-get install --only-upgrade puppetdb
2. Now, upgrade the puppetdb-termini package by running the following command in the package installer of your primary server.
Yum:
yum update puppetdb-termini
Apt:
apt-get update
apt-get install --only-upgrade puppetdb-termini
Upgrade Puppet Agents
It is recommended to upgrade Puppet Agents regularly for the smooth functioning of the system.

- Upgrade agents using the puppet_agent module
You can upgrade Puppet agents using the puppetlabs/puppet_agent module very easily. It supports upgrading Puppet agents on *nix, Windows, and macOS. To upgrade agents using the puppetlabs/puppet_agent module, install it first. Follow the steps below to proceed.
- Copy the puppet_agent class to agents you want to upgrade.
- Note open the forge of your site.pp file.
- In that file, mention the puppet_agent package and the parameters you want to upgrade to.
You can use the example site.pp file below for your reference.
# site.pp
node default
{
class
{
puppet_agent:
package_version => '8.1.6',
collection => 'puppet8'
}
}
This upgrades the Puppet Agent according to changes mentioned in the site.pp file.
Note that the above steps work only if the agent is managed by the Puppet Server. For those agents which are not managed by the Puppet Server, you need to declare the class in the puppet apply upgrade file.pp manifest. Use the example code below for the same.
# upgrade_file.pp
class
{
puppet_agent:
package_version => '7.0.0.224.gaf2034af',
yum_source => 'http://nightlies.puppet.com/yum',
collection => 'puppet7-nightly'
}
Once declared, now apply that manifest to complete the process.
- Upgrade *nix agents
Using the puppetlabs/puppet_agent module when upgrading among the major versions of Puppet agents is always advisable. If you want to upgrade *nix agents without this module, use the system’s package manager. Run the respective codes on the agent node based on your system package installer.
1. For Yum (EL/Fedora)
yum update puppet-agent
2. For Zypper (SLES)
zypper up puppet-agent
3. For Apt (Debian/Ubuntu)
apt-get update
apt-get install --only-upgrade puppet-agent
Ensure that you have the accurate package installed before upgrading any agents to a major version. You can find these packages from the respective official websites of your system package installer.
- Upgrade Windows agents
If you want to upgrade Windows agents without the puppetlabs/puppet_agent module, reinstall that agent using the installation instructions. There is no need to uninstall the previous agent before reinstalling unless you are upgrading from 32-bit to the 64-bit Puppet version.
- Upgrade macOS agents
You can utilize the puppet resource command to upgrade macOS agents without the puppetlabs/puppet_agent module.



