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 ‘’ {#include ajeet-environment




Hence the directory gets created on the puppetagent.


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 was overwhelmed to receive the first award in front of around 5000 audience.


Leave a Reply

Your e-mail address will not be published. Required fields are marked *