
Downloading and installing the Puppet agent
This is a very easy step. We just need to log in to one of our Windows servers or clients, and install the Puppet agent. You can download the latest installation file from https://downloads.puppetlabs.com/windows/. Always download the latest version that is compatible with your server. Make sure that the version number of your agent is not greater than your Puppet Master's version.
You can check your Puppet's version in Puppet Master using the following command:
$ puppet --version
Finally, download the correct version that is supported by your server/client, that is, 32 bits or 64 bits.
After the download, you need administrative rights to install the software. Just double-click and install the agent using the Next, Install, and, Finish buttons. You just need to enter the FQDN of the server correctly, as shown in the following screenshot:

After the installation, we can check whether everything has proceeded fine. Normally, you do not need to check whether it was installed properly. However, you may need the following details for troubleshooting. So, it is best to learn how to deal with the agent, and then test whether it is running without any problems.
The Puppet agent runs as a Windows service. Let's check whether there is one such service. When we check it, we can see whether it is listed as a service and whether it has already started, as shown in the following screenshot:

Now, from the Command Prompt, we will check the version of the agent and try a test run.
Note
You will need to open cmd.exe
with administrator rights, otherwise the Puppet test will work incorrectly. You will, also, need to run a new instance after the installation. If you try to use an already running Command Prompt, it will fail to find the puppet
command, as the new path definitions are not active in the running instance.
The command for checking the version in Windows is also the same as that of Puppet Master. The command is as follows:
C:\> puppet --version
Test run the agent using the following command:
C:\> puppet agent --test
Note
For puppet
to correctly resolve puppetmaster.example.com
, it is best to add a record in your DNS server. This detail was covered in Chapter 1, Installing Puppet Server and Foreman. If you did not add a record in your DNS, you can also change the hosts
file locally using C:\Windows\System32\drivers\etc\hosts
. However, this is not suggested because in this case, you have to manually modify each computer's hosts
file.
In the following screenshot, we can see that the agent version is 3.7.4
and the test run gives a certificate error. This is normal. We will now sign the certificate from Foreman and after this, the agent will be able to connect. The agent version and the result of the test run is as shown here:

Signing the certificate
Go to the Foreman web user interface. From the menu, select Infrastructure | Smart Proxies. On the smart proxies screen, as shown in the following screenshot, select Certificates, as this is the section to manage your hosts' certificates:

Here, you will see the new host and its status. As you can see in the following screenshot, the host is waiting in the pending status. Click the Sign button and sign the new host's certificate:

After this, we can go back to our host and run a new test to see what happens:

During the first run, the host successfully connected to the server. However, there is an error informing that it cannot find the node definition. This is fine. In the first connection, the node definition will be created. As you can see in the preceding screenshot, when you run the test again, there is no error because the node definition was created previously.
Now, let's switch back to Foreman and check whether the host details can be seen here. From the menu, select Hosts | All hosts. The details are as follows. We can see that the new host is added to our hosts list:

Summarizing, you only need the following two steps:
- Install the agent with correct server details
- Sign the certificate
All the other steps are for information and troubleshooting when you have problems of host connections.