Spread the love


In today’s session, we are going to quickstart writing a basic puppet module. A Very simple example could be creating a directory on remote Linux machines. Hence, we go further with this.

Aim – How to create a directory through Puppet?


1.Create a puppet module called ajeet-environment:

[root@puppetmaster modules]# puppet module generate ajeet-environment


  1. Under /etc/puppetlabs/puppet/modules/ajeet-environment/manifests , ensure that these files are present:

[root@puppetmaster manifests]# pwd


[root@puppetmaster manifests]# ls -la

total 16

drwxr-xr-x. 2 root root 4096 Jan 20 00:50 .

drwxr-xr-x. 5 root root 4096 Jan 20 00:43 ..

-rw-r–r–. 1 root root  289 Jan 20 00:50 createafile.pp

-rw-r–r–. 1 root root 1015 Jan 20 00:38 init.pp

  1. The Contents should look like:
lscreateafile.pp  init.pp[root@puppetmaster manifests]# cat createafile.pp

class createafile{

# create a directory

file { “/etc/sites-conf”:

ensure => “directory”,


# a fuller example, including permissions and ownership

file { “/var/log/admins-app-log”:

ensure => “directory”,

owner  => “root”,

group  => “wheel”,

mode   => 750,



File: init.pp

class ajeet-environment {include createafile}

File: site.pp

node ‘puppetagent1.cse.com’ {#include ajeet-environment


Machine: Puppetagent1.cse.com


Hence the directory gets created on the puppetagent.


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)


Leave a Reply

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

Join Collabnix SlackIt's 100% FREE!

Get chance to chat with 5500+ DevOps Engineers !