Ticket ID #174 ‐ Set up Puppet Agent on Apps - GriffinKat/group-a GitHub Wiki

Setup Puppet Agent on Applications Server

  • Step 1- Use the following command to update the server to ensure proper network connectivity.

    sudo apt update && sudo apt upgrade

    image

    image

    Press OK on the pink screens shown below.

    image

    image

  • Step 2- Add host entries to /etc/hosts file on all the servers to map private IP's to the hostname.

    Use the following command to get the private IP of the management server.

    ip addr show

    image

    NOTE: Follow the same command to get the private IP of all the servers.

    Now, edit the /etc/hosts file on the server and add the following lines under the first entry(for localhost):

    image

  • Step 3- Test connectivity by pinging the management server form the application server by pinging using hostname.

    image

  • Step 4- Setup the Puppet Agent.

    • 1. Add the puppet repository:

      wget https://apt.puppet.com/puppet7-release-jammy.deb

      image

      sudo dpkg -i puppet7-release-jammy.deb

      image

      sudo apt update

      image

    • 2. Install the Puppet agent package:

      sudo apt install puppet-agent -y

      image

    • 3. Configure the puppet agent:

      Edit the Puppet agent configuration file using the following command.

      sudo nano /etc/puppetlabs/puppet/puppet.conf

      Add the following lines under the [main] section:

      image

    • 4. Start and enable the Puppet agent:

      sudo systemctl start puppet

      sudo systemctl enable puppet

    • 5. Verify the Puppet agent is running:

      sudo systemctl status puppet

      image

Connect your agent to the puppet server

  • 1. Connect your agent to the puppet server manually with the following command:

    sudo /opt/puppetlabs/puppet/bin/puppet agent --server=mgmt-a --no-daemonize --verbose --onetime

    image

    NOTE: When a Puppet agent runs for the first time, it generates a private key and a Certificate Signing Request (CSR) with its certname. The CSR is sent to the Puppet master, which acts as a Certificate Authority (CA). The master verifies and signs the certificate, establishing trust between them. Once signed, the agent can securely communicate with the master and receive configuration updates. By default, certificate signing is manual for security, though auto-signing can be enabled in trusted environments.

    Now, we will configure the management server(Puppet Master) to sign the certificates and enable communication between Master and Agent. The steps for which are documented in the Puppet Master setup documentation.