Overview

Puppet uses its own language in order to assure that changes a properly propagated, in this section, we will use DSL do automate a lot of tasks like:

Creating & Modify Users

Install & Configure Packages

Implement System changes

All that will be accross our infrastructure, which unfortunetely is only 3 servers:

PuppetMaster

PuppetSlave

PuppetSlaveTwo

So let's start with the basic understanding of how DSL works. Puppet architecture is comprised by:

Resources (e.g. in-build functions & operations: file, user, router, etc, perform individual tasks)

Classes (e.g. combination of resources, multiple small operations)

Manifest (e.g. definitions and declarion of puppet classes)

Modules (e.g. collection of files and manifest, example: mysql & jenkins module)

Once an object is created it has to go through the chain of release as follows:

So let's see that in an example:

Creating & Modifying Users

To create a user, we will use a simple resource (e.g. function: user, to ensure that it exist)

Create

Create user

Then we can validate the code, for syntax error using the parser:

Check

Check syntax

Test

We can test if the application of the change will be possible:

Test

Finally we can apply the change:

Apply

Apply

We can also see that the user is created on the master server:

Check Results

Modify

What if we want to modify the user, let's say put the UID as 7777 and the shell as /bin/sh. Well, we can use the same file with more attributes:

Additional Attributes

As before, we can Check, test and apply the patch:

Check & Test & Apply the changes