Understand Basics of Puppet Modules - Puppet Tutorials

This post will help you to Understand Basics of Puppet Modules - Puppet Tutorials.

We will describe you,
  • What is puppet modules?
  • Why do we need puppet modules?
  • Do we really require programming language for writing puppet modules?
  • What is pre-existing puppet modules?


Understand Basics of Puppet Modules - Puppet Tutorials

Understand Basics of Puppet Modules - Puppet Tutorials


What is puppet modules?

Basically, A module is a collection of manifests and data (such as facts, files, and templates), and they have a specific directory structure.

Modules are useful for organizing your Puppet code, because they allow you to split your code into multiple manifests. It is considered the best practice to use modules to organize almost all of your Puppet manifests.

If you have understand the need of puppet manifests discussed in the previous post, this would be easy to understand the puppet modules.

ALSO WATCH THIS PUPPET MODULES TUTORIAL VIDEO FREE ON OUR YOUTUBE CHANNEL


For example, To install and manage Apache web server, we will write a puppet code in a single manifest file “/etc/puppet/manifests/site.pp” to perform specific operations like, precheck, enabling repo, installing package, managing services and other operations.

In modules, we split these operations into multiple manifests file and declare that as a classes using "include statement" as below.

Example : Declaration of classes within main manifest file.

node 'puppet-agent' {
include apache_precheck
include apache_enablerepo
include apache_apacheinstall
include apache_manageservice
include exec
Exec {
path => ['/bin', '/usr/bin'],
}
}

By implementing puppet modules, our main manifest file /etc/puppet/manifests/site.pp can become much smaller, more readable, and policy-focused.

Do we really require programming language for writing puppet modules?

For creating puppet modules, Yes, you should have a basic understanding of the Puppet language to become more familiar with Puppet modules, like what is classes, class declarations, class definitions and, so on.

Writing Puppet modules can be easier to those who has enough programming knowledge to develop the codes for modules.

What about others, who doesn't have programming knowledge?

Solution for that is, they can use the “pre-existing puppet modules” available in Forge and GitHub sites.

What is pre-existing puppet modules?

Pre-existing modules are written by the community for Open Source Puppet and Puppet Enterprise IT automation software. These are available publicly as a repository, You can use these puppet modules to your infrastructure by automating tasks such as setting up a database, web server, or mail server.

As of today, there are 4000+ modules are available as pre-existing puppet modules on Forge and GitHub. So straight way, we can use these pre-existing puppet modules. If you are good enough to write puppet modules, you can also contribute it to puppet community.

Thats all about the basics of puppet modules.
Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

Post a Comment

0 Comments