This is an old revision of the document!
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
[root@puppetmaster demo]# vi demouser.pp user { "julienandonov": ensure => "present", } :wq
Then we can validate the code, for syntax error using the parser:
Parse
Parse the file
--If error exists [root@puppetmaster demo]# puppet parser validate demouser.pp Error: Could not parse for environment production: Syntax error at 'ensure' (file: /var/tmp/demo/demouser.pp, line: 2, column: 3) [root@puppetmaster demo]# -If it no error exists [root@puppetmaster demo]# puppet parser validate demouser.pp [root@puppetmaster demo]#