Posts

Showing posts with the label group

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  ...

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  ...

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...

puppet resource???

*Resources in Puppet "puppet resource"* Understanding Resources is fundamental to understanding how Puppet works. Resources are like building blocks. They can be combined to model the expected state of the systems you manage.  For more information about the resources in puppet you can fire "puppet resource -h" on CLI. This command transforms the current system state into puppet code also it has the ability to modify the current state of the system. Syntax: resource_type { 'resource_name'   attribute => value   ... } Below are the few examples: To see all the users in the machine. [root@puppet ~]# puppet resource user  To see a particular user in the machine.   [root@puppet ~]# puppet resource user sunny user { 'sunny':   ensure           => 'present',   comment          => 'Sunny_B',   gid     ...