Create Two EC2 Instances - Amazon Linux - T2.medium (Master) & T2.micro (Slave) - SG: All Traffic
Create Two EC2 Instances - Amazon Linux - T2.medium (Master) & T2.micro (Slave) - SG: All Traffic
Create Two EC2 Instances - Amazon Linux - T2.medium (Master) & T2.micro (Slave) - SG: All Traffic
Pull – command is fired from agent to master, i.e., initiation is done in master
Puppet can be installed in two modes:
1. Standalone mode
2. Master-slave architecture mode
Connect to the instances using Putty and run the following commands on both
sudo -i
nano /etc/hosts
172.31.9.248 puppetmaster.example.com puppet
172.31.24.238 puppetagent.example.com
nano /etc/hostname
hostnamectl set-hostname puppetmaster.example.com (on master)
hostname
hostname
uname –a
systemctl status firewalld
hostnamectl set-hostname puppetagent.example.com (on slave)
nano /etc/hostname (notice the hostname has changed)
sudo reboot
ping puppetagent.example.com (on master)
ping puppetmaster.example.com (on slave)
Puppet follows master-slave architecture, hence puppet server will be installed on master & puppet
agent will be installed on slave
sudo -i
sudo rpm -Uvh https://yum.puppet.com/puppet6-release-el-7.noarch.rpm (install Puppet package
repositories using rpm, this installs a package which lets the Operating System know where to
download the Puppet server from)
yum repolist (to fetch repository)
yum list | grep -i puppet
On master:
ip addr (copy the private ip address and ping it but you don’t get any response)
ICMP protocol should be enabled in security group of the master & client instances for pinging each
other.
Now ping again & it’s successful now (from both master & agent)
In case you select master to e t2.micro, execute the following steps on master:
cd /etc/sysconfig/
nano puppetserver
systemctl start puppetserver
systemctl status puppetserver
On slave:
/opt/puppetlabs/bin/puppetserver ca list
ln –s /opt/puppetlabs/bin/puppet /usr/bin/puppet (to create a soft link)
/opt/puppetlabs/bin/puppetserver ca list –all (certificate of master is displayed, agent’s certificate
will be displayed once agent requests for its certificate & master signs it)
On slave:
On master:
cd /etc/puppetlabs/code/environments/production/modules/
/opt/puppetlabs/bin/puppet resource package sshd
mkdir mypackage/manifests –p
cd mypackage/manifests/
nano init.pp
On slave:
On master:
On slave:
Autosigning process
On master:
cd /etc/puppetlabs/puppet
vi autosign.conf
https://puppet.com/docs/puppet/6.17/lang_visual_index.html#lang_visual_index
https://www.tutorialspoint.com/puppet/puppet_manifest_files.htm
On master:
On slave:
cd /etc/puppetlabs/puppet/ssl
ls
cd ..
rm -rf ssl/
ls
systemctl enable --now puppet
ls
systemctl status puppet
rm -rf /etc/puppetlabs/puppet/ssl/
puppet agent --test --verbose
systemctl status puppet
systemctl restart puppet
systemctl status puppet
puppet agent --test --verbose
git –version
puppet agent --test --verbose