Hello techies in our previous articles we have discussed the following topics :
- How to Install Katello 3.2 on CentOS 7.x
- Katello – Download Yum Repositories and Register clients for patching
Apart from package management katello Server can also act as puppet master server and allows to create repository of puppet modules. Puppet module can be imported into the repository from Git, Puppet forge and local puppet modules directory.
In this article we will discuss how import puppet modules into a puppet repository from local puppet directory, I am assuming Katello Server is already installed and configured.
Let’s first create a folder for puppet modules and download the modules whatever you want import into puppet repository in katello. In my case i have download ntp and sudo puppet modules
root@katello ~]# mkdir /opt/modules [root@katello ~]# chmod 755 /opt/modules [root@katello ~]# pulp-puppet-module-builder --output-dir=/opt/modules /tmp/saz-ntp-2.4.0/ cd /tmp/saz-ntp-2.4.0/ git status find . -name Modulefile -o -name metadata.json puppet module build . mkdir -p /opt/modules cp ./pkg/saz-ntp-2.4.0.tar.gz /opt/modules cd /opt/modules cd /tmp/saz-ntp-2.4.0 cd /root [root@katello ~]# [root@katello ~]# pulp-puppet-module-builder --output-dir=/opt/modules /tmp/saz-sudo-3.1.0 cd /tmp/saz-sudo-3.1.0 git status find . -name Modulefile -o -name metadata.json puppet module build . mkdir -p /opt/modules cp ./pkg/saz-sudo-3.1.0.tar.gz /opt/modules cd /opt/modules cd /tmp/saz-sudo-3.1.0 cd /root [root@katello ~]#
Similarly you can build as many as modules as you want and while creating puppet repository specify the URL as “file:///opt/modules”
Refer the following steps to import and manage puppet modules from Katello dashboard.
Step:1 Login to Katello Dashboard
Step:2 Create Puppet Repository under your product
As per my previous article i am taking organization as “Operations” and Product as “CentOS 7”
First select organization as “Operations” after that go to Products option from Content Tab.
Click “CentOS 7” Product and select “create repository” option
Specify the following parameters
- Name = Puppet Modules
- Label = <Label will be picked automatically>
- Type = puppet
- URL = file:///opt/modules
Click on Save
Now go to Puppet Module repository and sync it.
Step:3 Add Puppet Modules in Content Views and Promote it
From the Content Tab go to Content views, click on the Content view whatever you have created, as per my previous article i had created “Operation View” as content view.
Go to the “Puppet Modules” and click on “+Add New Module”
Select the latest version of both modules and then Click on “Publish New version”
First time updated content view will promoted to library environment. Once it is completed then we will promote to next environment ( In My case i had created two env : Production and non production)
Now promote new version of content view to next environment, click on “Promote” and select the environment and the click on “Promote Version”
Once it promoted successfully, New Puppet environments will created under Configure –> Puppet –> Environment with name like “KT_Operations_Non_Production_Operations_View_3“.Make sure under this environment your organization and location is updated.
Step:4 Create new Activation Key and update its subscription
From the Content Tab select Activation keys and Click on “+New Activation Key”
click on Save
Once the Key is created, Go to Subscription Tab, Click on Add , Select “CentOS 7” as product and then click on “Add Selected” option
Step:5 Create a Host Group and add puppet environment and modules to it.
From the Configure Tab select “Host groups” and then click on “New Host Group“, Specify the parameters
From the “Puppet Classes” Tab, add ntp and sudo class.
Click on “Submit”
Step:6 Register client to Katello Server with Activation key
Go to the client machine and run below command to register it with katello Server
[root@web ~]# subscription-manager register --org="Operations" --activationkey="Operations_Puppet_Non_Prod"
Run below commands to verify which yum repository are available to this system
[root@web ~]# subscription-manager repos --list
or
[root@web ~]# yum repolist
Once the system is register then it will be visible in katello dashboard, Go to Hosts Tab select All Hosts
click on Edit, Specify as Host group whatever we have created in above steps, in my case it is “Non Production”
Click on “Submit”
Once we specify the Host group, then it will automatically add puppet modules whatever we have associated modules with host group in above steps.
Run the puppet agent from the Client machine to apply puppet modules.
[root@web ~]# puppet agent --test --server katello.example.com
That’s all from this article. Hope you guys got an idea how to import and manage puppet modules in Katello Dashboard
Great doc, thanks. But how would I add a command alias for a user in the saz_sudo module? for example, if i wanted user1 to run some specific command using sudo? i can add users to the smart class but how to specify user to run command?