Ajeet Raina I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I am a maintainer of Collabnix blogging site. I work for Redis and a primary maintainer of https://developer.redis.com. I run Collabnix Community Slack with over 6500+ audience . We have built a popular projects like Docker Labs, KubeLabs, KubeTools and DockerTools. You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

Learn Puppet With Me – Day 4

38 sec read

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?

Steps:

1.Create a puppet module called ajeet-environment:

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

ajeet-environment

  1. Under /etc/puppetlabs/puppet/modules/ajeet-environment/manifests , ensure that these files are present:
[root@puppetmaster manifests]# pwd

/etc/puppetlabs/puppet/modules/ajeet-environment/manifests

[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

puppetagent-1

Hence the directory gets created on the puppetagent.

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I am a maintainer of Collabnix blogging site. I work for Redis and a primary maintainer of https://developer.redis.com. I run Collabnix Community Slack with over 6500+ audience . We have built a popular projects like Docker Labs, KubeLabs, KubeTools and DockerTools. You can follow me on Twitter(@ajeetsraina) & GitHub(@ajeetraina)

What is a Dockerfile – A Step-By-Step Guide

A Dockerfile is a text file which contains a series of commands or instructions. These instructions are executed in the order in which they...
Ajeet Raina
21 min read

Docker Desktop for Linux,  Docker Extensions and more with…

Docker Desktop 4.8.2 is now available for download for Mac, Windows and Linux. Here are the major highlights: Docker Desktop for various Linux distributions made available for the first...
Ajeet Raina
1 min read

Leave a Reply