Posts

Showing posts from 2015

Featured Post

Directory environments in Puppet

Environments are individual groups of Puppet agents each environment have there own completely different manifests and module-paths. This basically is useful for testing changes to our Puppet code before implementing them on production machines. There are two types of implementation of environments structure in Puppet one if directory based and another is config file based here we will see bit of an insight about directory based. As usual for more information about this you can visit puppetlabs official website. On the master node: Append following details in puppet.conf which is placed under /etc/puppet or /etc/puppetlabs/puppet:     Under [main] section add a variable called confdir with value as /etc/puppet or /etc/puppetlabs/puppet     confdir=/etc/puppet Then add information regarding environments/manifests and modulepath in it.      #environments     environmentpath = $confdir/environments     default_manfiest = $confdir/manifests     basemodulepath =

Manifests

Manifests Puppet programs are called “manifests,” and they use the .pp file extension. The core of the Puppet language is the resource declaration. A resource declaration describes a desired state for one resource. (Manifests can also use various kinds of logic: conditional statements, collections of resources, functions to generate text, etc. We’ll get to these later.) [root@server demo_manifests]# cat add_user.pp user { 'optimus':   ensure => 'present',   home   => '/home/optimus',   shell  => '/bin/bash', } [root@server demo_manifests]# [root@server demo_manifests]# puppet apply /root/Desktop/demo_manifests/add_user.pp notice: /Stage[main]//User[optimus]/ensure: created notice: Finished catalog run in 0.21 seconds [root@server demo_manifests]# Puppet Apply Like resource in the last chapter, apply is a Puppet subcommand. It takes the name of a manifest file as its argument, and enforces the desired state descri