Puppet : Writing simple “Motd” module

Share At:

In my previous article, titled,“Puppet: Writing simple manifests” , I wrote about how to write simple manifest to create a user.

In this article, we are going to see more complex way of writing manifests using “modules”.

We will see how can we write a simple module called “motd” and display the banner when we login to any puppet-client.

Please follow below steps in sequence:

  1. Please change to “/etc/puppetlabs/code/environments/production/modules” in Puppet-Master.

2. Now create below Directories as mentioned below:

3. Now go to “manifests” directory inside “motd” directory and create “init.pp” file such that it has entry as below:

4. Now go to files Directory and create a file named “motd” like below.

You can create “motd” like below using some professional banner generator using below link:

http://www.bagill.com/ascii-sig.php

5. Now go to “/etc/puppetlabs/code/environments/production/manifests” directory and modify “site.pp” to look like below:

6. Now run below commands in sequence:

puppet parser validate site.pp

puppet apply — noop site.pp

puppet apply site.pp

7. Now logout / log back in in Puppet-Master server. You will see the banner when you login:

8. Now login to Puppet-client and run below command:

puppet agent -t

9. Now try to log out / log back in to puppet-client , you should get something like below as banner when you login.

That’s It. We are done !!

Point to remember

For our example , same result can be achieved if we write site.pp like below. This will set banner on all the servers:

However for better understanding, we have written “site.pp” like earlier in our example so that we can set banners on selective servers only.

Happy Learning !!


Share At:
0 0 votes
Article Rating
Subscribe
Notify of
guest
3 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
shiba canlı yorum
3 months ago

Reading your article helped me a lot and I agree with you. But I still have some doubts, can you clarify for me? I’ll keep an eye out for your answers.

bilecik ekonomi sitesi
5 months ago

thank you

adana ajans
6 months ago

thank you

Back To Top

Contact Us