Question: The Nautilus DevOps team was working on developing some custom RPMs to meet some application needs. Most of those RPMs will be installed on all application servers in Stratos Datacenter. So to accomplish this task we need to configure a local yum repository on all app servers so that we can install those custom RPMs from that local yum repository. But this task needs to be done using Puppet, below you can find more details.
Create a puppet programming file cluster.pp under /etc/puppetlabs/code/environments/production/manifests directory on master node i.e on Jump Server.
Define a class local_yum_repo and perform below mentioned tasks:
There are some RPMs already present at location /packages/downloaded_rpms on all puppet agent nodes i.e on all App Servers.
Create a local yum repository named epel_local (make sure to set Repository ID to epel_local). Configure it to use packages location /packages/downloaded_rpms on all puppet agent nodes i.e on all App Servers.
Install package samba from this newly created repository through on all puppet agent nodes i.e on all App Servers.
Make sure to create a single puppet programming file cluster.pp to configure local yum repository and install the package.
Note: Please perform this task using cluster.pp only, do not create any separate inventory file.
Please Note :- Perform the below commands based on your question server, user name & other details might differ . So please read task carefully before executing. All the Best 👍
root@jump_host /# cd /etc/puppetlabs/code/environments/production/manifests/ root@jump_host /etc/puppetlabs/code/environments/production/manifests# ll total 0 root@jump_host /etc/puppetlabs/code/environments/production/manifests# root@jump_host /etc/puppetlabs/code/environments/production/manifests# vi cluster.pp root@jump_host /etc/puppetlabs/code/environments/production/manifests# cat cluster.pp class local_yum_repo { #Setup epel_local repo yumrepo { 'epel_local': enabled => 1, descr => 'Local epel repo for app pckgs', baseurl => 'file:///packages/downloaded_rpms', gpgcheck => 0, } #Install package from this repo package { 'samba': ensure => 'installed', require => Yumrepo['epel_local'], } } node 'stapp01.stratos.xfusioncorp.com', 'stapp02.stratos.xfusioncorp.com', 'stapp03.stratos.xfusioncorp.com' { include local_yum_repo } root@jump_host /etc/puppetlabs/code/environments/production/manifests# |
root@jump_host /etc/puppetlabs/code/environments/production/manifests# puppet parser validate cluster.pp root@jump_host /etc/puppetlabs/code/environments/production/manifests# |
3. Login on all App server (stapp01, stapp02, stapp03 ) & switch to root user
root@jump_host /# ssh tony@stapp01 The authenticity of host 'stapp01 (172.16.238.10)' can't be established. ECDSA key fingerprint is SHA256:w9cDRojDoclOxdu1W23Ns2HPyANPrDzhk9VfqtTDoJQ. ECDSA key fingerprint is MD5:a8:3b:55:35:c2:5c:56:76:c8:d0:78:13:7a:4d:8b:e1. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'stapp01,172.16.238.10' (ECDSA) to the list of known hosts. tony@stapp01's password: [tony@stapp01 ~]$ sudo su - We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for tony: [root@stapp01 ~]# |
4. Run Puppet agent to pull the configuration from puppet server
[root@stapp01 ~]# puppet agent -tv Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Retrieving locales Info: Loading facts Info: Caching catalog for stapp01.stratos.xfusioncorp.com Info: Applying configuration version '1624860136' Notice: /Stage[main]/Local_yum_repo/Yumrepo[epel_local]/ensure: created Notice: Applied catalog in 0.09 seconds [root@stapp01 ~]# |
5. Validate the task by running
[root@stapp01
~]# yum list samba Loaded plugins:
fastestmirror, ovl Loading mirror
speeds from cached hostfile Installed Packages samba.x86_64
4.10.4-10.el7 @epel_local [root@stapp01
~]# |
6. Click on Finish & Confirm to complete the task successful
Happy Learning!!!!
0 Comments