[go: up one dir, main page]

0% found this document useful (0 votes)
16 views7 pages

Puppet Installation and Working

This document provides a step-by-step guide on installing Puppet on Ubuntu, including setting up both the Puppet server and agent on a single machine. It details the installation commands, configuration file settings, and testing procedures to ensure proper functionality. Additionally, it includes exercises for creating files and installing packages using Puppet manifests.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Puppet Installation and Working

This document provides a step-by-step guide on installing Puppet on Ubuntu, including setting up both the Puppet server and agent on a single machine. It details the installation commands, configuration file settings, and testing procedures to ensure proper functionality. Additionally, it includes exercises for creating files and installing packages using Puppet manifests.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Exercise 6: Installing Puppet on Ubuntu

In this exercise you will learn how to install Puppet on Ubuntu

Procedure -
For puppet installation you will install both master and client/agent on single node.

1. You need to install puppet server(master) and puppet agent both on the same
machine
$ sudo wget https://apt.puppetlabs.com/puppet8-release-jammy.deb

$ sudo dpkg -i puppet8-release-jammy.deb

$ sudo apt-get update


$ sudo apt-get install puppetserver
$sudo systemctl start puppetserver
$sudo systemctl enable puppetserver
$sudo systemctl status puppetserver

Next, type the below and press enter

$ bash -l
If you correctly installed the puppetserver it will show the version of puppetserver by
giving the below command
$ puppetserver -v

2. Now install puppet agent by giving the following command


$ sudo apt install puppet-agent

$ sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true

3. Next step is to configure the puppet services, for this you need to use puppet config
file by giving this below command and paste the below code
$sudo nano /etc/puppetlabs/puppet/puppet.conf
[main]
environmentpath = /opt/puppetlabs/environments
environment = devops

[server]
vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /var/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /etc/puppetlabs/code
certname = admin.myguest.virtualbox.org ssl_
client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY

[agent]
certname = admin.myguest.virtualbox.org
server = admin.myguest.virtualbox.org

4. List all the Certificate Authority certificates managed by the puppet server and check
the status as signed as shown in the below
sudo /opt/puppetlabs/bin/puppetserver ca list --all

5. Test the Puppet agent by giving the following command to check for and apply any
necessary configurations.

sudo /opt/puppetlabs/bin/puppet agent --test

6. Let’s create a directory called devops inside the path /opt/puppet/environments


$ sudo mkdir -p /opt/puppetlabs/environments/devops/

And please move the files from the


path /etc/puppetlabs/code/environments/production/ to
the /opt/puppetlabs/environments/devops/ by giving the below command

mv file1 file2 /opt/puppetlabs/environments/devops/

If you want to see the files after moving, use the below command
$ ls /opt/puppetlabs/environments/devops

Puppet installation and configuration of both puppetserver and agent is done with the
above steps.

Exercise 7: Puppet Exercise


1. In this exercise you will check the existence of a file and create if it is not present.
Place the below source code in the .pp file by giving the command and save it.

$ sudo nano
/opt/puppetlabs/environments/devops/manifests/CreatefileIfNotExists.pp

file { '/home/administrator/Desktop/Wallpaper.png':
ensure => present
}

With the help of the below command you can see the content which you pasted inside
the .pp file

$ sudo cat
/opt/puppetlabs/environments/devops/manifests/CreatefileIfNotExists.pp

2. Now run the puppet apply command to apply the configuration by changing the
path to /opt/puppetlabs/environments/devops/manifests/ using the below
command
$ cd /opt/puppetlabs/environments/devops/manifests/
And apply
$ puppet apply CreatefileIfNotExists.pp

Next change the directory and list the files to see whether the wallpaper.png file is
created or not in the Desktop since the same directory specified in the .pp file.

cd Desktop

ls
3. In this exercise you will also install a package via puppet agent with root login.
For this, place this resource code in sql_Install.pp file by creating in the same path as
same as CreatefileIfNotExists.pp with the below commands

$ su –

$ sudo nano /opt/puppetlabs/environments/devops/manifests/ sql_Install.pp

4. Now run the puppet apply command to apply the configuration by changing the path
to /opt/puppetlabs/environments/devops/manifests/ using the below command

$ cd /opt/puppetlabs/environments/devops/manifests/
And apply
$ sudo puppet apply sql_Install.pp

After you run the above command, the sql_Install.pp configuration is applied, and you
can see the new file created in the specified directory.
ls

The above command updated puppet configuration (install mysql-server) on our


agent, so verify the installation –

sudo mysql

Mysql is installed on agent using the puppet configuration.

You might also like