Spread the love


Today we are going to learn about Puppet Modules.

What is Puppet Modules? Puppetlabs defines it as “Modules are self-contained bundles of code and data. You can write your own modules or you can download pre-built modules from the Puppet Forge.”Nearly all Puppet manifests belong in modules. The sole exception is the main site.pp manifest, which contains site-wide and node-specific code.


Modules are how Puppet finds the classes and types it can use — it automatically loads any classor defined type stored in its modules.

Module Layout

On disk, a module is simply a directory tree with a specific, predictable structure:

    • manifests
    • files
    • templates
    • lib
    • facts.d
    • tests
    • spec

We will start with basic module and slowly move towards the complex module structure.

Let’s begin:

#mkdir modules/memcached
#mkdir modules/memcached/manifests
#mkdir modules/memcached/files
#vi nodes.pp

node ‘puppetagent1.cse.com’ {
include memcached
#define memcached class in the file init.pp
#vi modules/memcached/manifests/init.pp

class memcached {
package { ‘memcached’:
ensure => installed,

file { ‘/etc/memcached.conf’:
source => puppet:///modules/memcached/memcached.conf’,
owner => ‘root’,
group => ‘root’,
mode => ‘0644’,
require => Package[‘memcached’],

service { ‘memcached’:
ensure => running,
enable => true,
require => [Package[‘memcached’], File[ ‘/etc/memcached.conf’]]

That’s all. You can go ahead and run puppet agent -t on puppet client machine to get memcache ready.


Spread the love
Categories: Docker

Ajeet Raina

My name is Ajeet Singh Raina and I am an author of this blogging site. I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I bagged 2 special awards last year(2019): Firstly, “The Tip of Captain’s Hat Award” at Dockercon 2019, San Francisco, and secondly, “2019 Docker Community Award“. I run Collabnix Community Slack with over 5300+ audience . I have built popular GITHUB repositories like DockerLabs, KubeLabs, Kubetools, RedisPlanet Terraform etc. with the support of Collabnix Community. Currently working as Developer Relations Manager at Redis Labs where I help customers and community members adopt Redis. With over 12,000+ followers over LinkedIn & close to 5100+ twitter followers, I like sharing Docker and Kubernetes related content . You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)


web · 10th October 2016 at 12:54 am

I just want to say I’m newbie to weblog and honestly loved you’re blog. More than likely I’m want to bookmark your website . You definitely have amazing stories. With thanks for sharing with us your webpage.

Samual Howlett · 11th October 2016 at 12:11 am

Do you have a spam issue on this site; I also am a blogger, and I was wanting to know your situation; we have created some nice methods and we are looking to trade solutions with others, why not shoot me an e-mail if interested.|

Santo Roner · 10th November 2016 at 5:38 am

This actually answered my problem, thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *