Showing posts with label Puppet Master. Show all posts
Showing posts with label Puppet Master. Show all posts

Tuesday, February 2, 2021

How to install Puppet 7 on Ubuntu 18.0.4 | Puppet Master install Ubuntu 18.0.4 | Setup Puppet 7 on Ubuntu

Puppet is a configuration management tool, similar to Ansible, Chef and SaltStack. Puppet also can be used for automating infrastrcture as well.

  • Configuration management tool
  • Used for infrastructure automation as well 
  • An open source, written in Ruby
  • Uses Domain Specific Language (DSL) to describe system configuration
  • Comes in two version - Open source & Puppet Enterprise 
  • Puppet is based in client/server model.  
The server does all the automation of tasks on nodes/servers that have a client(agent) installed. The work of the Puppet agent is to send facts to the puppet master and request a catalog based on certain interval level(default time 30 mins). Once it receives a catalog, Puppet agent applies it to the node by checking each resource the catalog describes. It makes relevant changes to attain the desired state. The work of the Puppet master is to control configuration information.  Each managed agent node requests its own configuration catalog from the master.

We will see how to setup Puppet Master in Ubuntu 18.0.4.



Watch the steps for setting up Puppet Master:

Pre-requisites:
Install Puppet master on new Ubuntu with medium instance
port 8140 needs to be opened.

Steps:
First let us see how to install Puppet 7.x on Ubuntu 18.0.4.

Steps for Puppet Master Installation
Modify Puppet Master Hosts file to add hostname of Puppet Master
sudo vi /etc/hosts

Download puppet installables

sudo curl -O https://apt.puppetlabs.com/puppet7-release-bionic.deb
sudo dpkg -i puppet7-release-bionic.deb
sudo apt-get update

Install Puppet

sudo apt-get install puppetserver -y

sudo systemctl enable puppetserver.service


 

(the above command is to start the service during starting the Ubuntu instance)

Start Puppet Server

sudo systemctl start puppetserver.service  

(The above command is for starting the server and this may take some time)         









sudo systemctl status puppetserver.service


Now press q to come out of window.
Add puppet master ip address and puppet next to it like shown below

This confirms that Puppet Master is installed successfully.

Verify which version of Puppet installed by executing below command:
apt policy puppetserver

Set Puppet into Path
sudo cp /opt/puppetlabs/bin/puppet /usr/bin/ -v
sudo cp /opt/puppetlabs/puppet/bin/gem  /usr/bin/ -v

Check Puppet version
puppet --version
It should displays something like below:
7.3.0

Install AWS SDK Gems
You need to install the aws-sdk-core and retries gems as root (or superuser):
sudo gem install aws-sdk-core retries
Done installing documentation for retries after 0 seconds
6 gems installed
Also install AWS SDK for accessing resources in AWS
sudo gem install aws-sdk -v 2.0.42

Done installing documentation for retries after 0 seconds
4 gems installed
Install puppet-labs-aws module
sudo puppet module install puppetlabs-aws

That's it. Puppet Master is setup successfully!!!! You can watch the above steps in YouTube as well. 

Friday, August 28, 2020

How to install Puppet 6 on Ubuntu 18.0.4 | Puppet Master install Ubuntu 18.0.4 | Setup Puppet on Ubuntu

Puppet is a configuration management tool, similar to Ansible, Chef and SaltStack. Puppet also can be used for automating infrastrcture as well.

Puppet is based in client/server model. The server does all the automation of tasks on nodes/servers that have a client(agent) installed. The work of the Puppet agent is to send facts to the puppet master and request a catalog based on certain interval level(default time 30 mins). Once it receives a catalog, Puppet agent applies it to the node by checking each resource the catalog describes. It makes relevant changes to attain the desired state. The work of the Puppet master is to control configuration information.  Each managed agent node requests its own configuration catalog from the master.

We will see how to setup Puppet Master in Ubuntu 18.0.4.



Pre-requistes:
Install Puppet master on new Ubuntu with medium instance
port 8140 needs to be opened.

Steps:
First let us see how to install Puppet 6.x on Ubuntu 18.0.4.

Steps for Puppet Master Installation
1. Modify Puppet Master Hosts file to add hostname of Puppet Master
sudo vi /etc/hosts

2. Download puppet installable

curl -O https://apt.puppetlabs.com/puppet6-release-bionic.deb
sudo dpkg -i puppet6-release-bionic.deb
sudo apt-get update
sudo apt-get install puppetserver -y
sudo ufw allow 8140
sudo systemctl enable puppetserver.service






(the above command is to start the service during starting the Ubuntu instance)
sudo systemctl start puppetserver.service           








(The above command is for starting the server and this may take some time)
sudo systemctl status puppetserver.service


Now press q to come out of window.
Add puppet master ip address and puppet next to it like shown below

This confirms that Puppet Master is installed successfully.

Verify which version of Puppet installed by executing below command:
apt policy puppetserver

2. you need to install the aws-sdk-core and retries gems as root (or superuser):
sudo /opt/puppetlabs/puppet/bin/gem install aws-sdk-core retries
Done installing documentation for retries after 0 seconds
6 gems installed
3. Also install AWS SDK for accessing resources in AWS
sudo /opt/puppetlabs/puppet/bin/gem install aws-sdk -v 2.0.42

Done installing documentation for retries after 0 seconds
4 gems installed
4. Now you can install puppet-labs-aws module
sudo /opt/puppetlabs/bin/puppet module install puppetlabs-aws

That's it. Puppet Master is setup successfully!!!! You can watch the above steps in YouTube as well.

Tuesday, April 28, 2020

How to configure Puppet Master and integrate with Puppet Agent/nodes on Ubuntu 18.0.4 | Puppet Master and Agent integration

Puppet uses Client/Server model. The server does all the automation of tasks on nodes/servers that have a client(agent) installed. The work of the Puppet agent is to send facts to the puppet master and request a catalog based on certain interval level(default time 30 mins). Once it receives a catalog, Puppet agent applies it to the node by checking each resource the catalog describes. It makes relevant changes to attain the desired state. The work of the Puppet master is to control configuration information.  Each managed agent node requests its own configuration catalog from the master.

Please find the steps needed for Integrating Puppet master and agent on Ubuntu 18.0.4:
Watch the steps in YouTube video:

Pre-requisites:

a) One Ubuntu instance for Puppet Master - this instance should have 4 GB RAM, in AWS instance type should be at least t2.medium.
 Master ubuntu EC2 should have a security group to ensure that below ports are open in security firewall
        * TCP 8140 - Agents will talk to the master on this port(puppet enterprise)
        * TCP 22 - To login to the server/instance using SSH

b) one Ubuntu instance as node which will have agent installed - This can be micro instance.

1 Steps for Puppet Master:
Modify Puppet Master Hosts file to add hostname of Puppet Master
sudo vi /etc/hosts

(Add puppet master ip address and puppet next to it like shown below)




Download Puppet Master installation packages

curl -O https://apt.puppetlabs.com/puppet6-release-bionic.deb
sudo dpkg -i puppet6-release-bionic.deb
sudo apt-get update


Install Puppet Master

sudo apt-get install puppetserver -y
sudo ufw allow 8140
sudo systemctl enable puppetserver.service






(the above command is to start the service during starting the Ubuntu instance)
sudo systemctl start puppetserver.service           
(The above command is for starting the server and this may take some time)










sudo systemctl status puppetserver.service

Now press q to come out of window.

Verify version of Puppet Master

apt policy puppetserver










2 - Steps for Puppet Agent

Step 2.1 First edit the hosts file on the puppet agent by modifying /etc/hosts
sudo vi /etc/hosts

# Please add Puppet Master server IP address and space and enter puppet
puppet_master_ip_address   puppet


(please do not use public DNS name, use only private IP address)  

Press Ctrl O for saving and then enter
Press Ctrl X for exit after saving
.

Step 2.2 — Installing Puppet Agent on server node that Puppet master will manage
curl -O https://apt.puppetlabs.com/puppet6-release-bionic.deb
sudo dpkg -i puppet6-release-bionic.deb
sudo apt-get update
sudo apt-get install puppet-agent -y
sudo systemctl enable puppet
sudo systemctl restart puppet
sudo systemctl status puppet


 




Now press q to come out of window.

Step 3 - Signing certificates on Puppet Master
The first time you run the Puppet agent, it generates an SSL certificate and sends a signing request to the Puppet master. After the Puppet master signs the agent's certificate, it will be able to communicate  with and control the agent node.

First list the unsigned certificates on puppet master EC2 instance

sudo /opt/puppetlabs/server/bin/puppetserver ca list

The above command will list agent ip address.
  "your_puppet_Agent_Ec2_private_dns_name"  (SHA256) 46:19:79:3F:70:19:0A:FB:DA:3D:C8:74:47:EF:C8:B0:05:8A:06:50:2B:40:B3:B9:26:35:F6:96:17:85:5E:7C


Now sign the Puppet agent IP address.
sudo /opt/puppetlabs/server/bin/puppetserver ca sign --certname 
AgentEc2_private_dnsname

Step 4 - Verifying installation by creating Manifests in Puppet Master

The puppet manifest file is the actual file which contains the configuration details for the agents. This file is centrally stored at Puppet Master.

sudo nano /etc/puppetlabs/code/environments/production/manifests/site.pp

#copy the below yellow lines in the above file
    file {'/tmp/puppet_test.txt':                        # resource type file and filename
    ensure  => present,                      
       # make sure it exists
    mode    => '0644',                       
       # file permissions
  content => "Hello from Puppet master to agent on ${ipaddress_eth0}!\n",  # Print the eth0 IP fact
    }


Press Ctrl O for saving and then enter
Press Ctrl X for exit after saving
.



Step 5 - Apply Manifests in Puppet Agent
apply the changes in puppet agent by executing below command:
sudo /opt/puppetlabs/bin/puppet agent --test



 



You should see a file being modified in /tmp/puppet_works.txt in agent(node).
You can confirm by typing this command on puppet node 

sudo cat /tmp/puppet_test.txt
Hello from Puppet master to agent on IP_address!!

That's it! you have set up Puppet Master and configured agent on the target node successfully!

🚀 Live AI-Enabled DevSecOps & Cloud Engineering Bootcamp – Sep 2026

Live AI-Enabled DevSecOps & Cloud Engineering Bootcamp from Coach AK - Sep 2026 Schedule