
In my previous article, titled,“Puppet : Writing simple “Motd” module” , I wrote about how to write simple “motd” module to display motd when someone login to any server in the environment.
In this article, we are going to see more complex way of writing manifests using “modules”.
We will see how can we write a complex module called “motd” and display the banner when we login to any puppet-client.

Please follow below steps in sequence:
- 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. The information gathered through “Facts” can be gathered using facter command.
In the above init.pp , we have passed the information gathered through facts to different variables.

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


puppet parser validate init.pp
puppet agent -t

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 !!

Very nice post. I just stumbled upon your blog and wanted to say that I’ve really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!