Showing posts with label manifest. Show all posts
Showing posts with label manifest. Show all posts

Saturday, 23 April 2016

getting started puppet manifest

getting started puppet manifest

1) check the default resources list for puppet.

cmd :
puppet resource [-h|--help] [-d|--debug] [-v|--verbose] [-e|--edit] [-p|--param parameter] [-t|--types] [-y|--to_yaml] type [name] [attribute=value ...]

REF : puppet

command : puppet resources --types

output :

augeas,computer,cron,exec,file,filebucket,group,host,interface,k5login,macauthorization,mailalias,maillist,mcx,mount,nagios_command
nagios_contact,nagios_contactgroup,nagios_host,nagios_hostdependency,nagios_hostescalation,nagios_hostextinfo,nagios_hostgroup,
nagios_service,nagios_servicedependency,nagios_serviceescalation,nagios_serviceextinfo,nagios_servicegroup,nagios_timeperiod
notify,package,resources,router,schedule,scheduled_task,selboolean,selmodule,service,ssh_authorized_key,sshkey,stage,tidy,user
vlan,whit,yumrepo,zfs,zone,zpool.

2) here in puppet, program are called as manifest.
ex : root.pp.

3) class can be defined as the resuseable component, can be called/used from any where.

def :

class classname {

puppet code

}

Friday, 22 April 2016

start puppet and check states of users


1)  start the puppet master.

cmd : systemctl start puppet

check process running on linux.
cmd : top (http://www.cyberciti.biz/faq/show-all-running-processes-in-linux/)

How to check processor and cpu details on Linux
cmd : lscpu
----------------------'
1) puppet will tell state of user.
cmd : puppet resource user root.

output :

user { 'root':
  ensure           => 'present',
  comment          => 'root',
  gid              => '0',
  home             => '/root',
  password         => '!!!!!!',
  password_max_age => '99999',
  password_min_age => '0',
  shell            => '/bin/bash',
  uid              => '12',
}
2) change state of shell command from bash to sh.
a) create a mnifest of the root user.

cmd : sudo puppet resource user root > root.pp

b) save and open the manifest file.

user { 'root':
  ensure           => 'present',
  comment          => 'root',
  gid              => '0',
  home             => '/root',
  password         => '!!!!!!',
  password_max_age => '99999',
  password_min_age => '0',
  shell            => '/bin/sh',
  uid              => '12',
}

c) apply the manifest

puppet apply root.pp

d) now check state of the user again.

cmd : puppet resource user root.

user { 'root':
  ensure           => 'present',
  comment          => 'root',
  gid              => '0',
  home             => '/root',
  password         => '!!!!!!',
  password_max_age => '99999',
  password_min_age => '0',
  shell            => '/bin/sh',
  uid              => '12',
}


3) now if we want to just simulate and dont want to change the state.

cmd :

a) vim root.pp

user { 'root':
  .
  .
  shell            => '/bin/bash',
  .
}
b) puppet apply root.pp  --noop (it show what all the changes might happen to the state if we use it)

REF  :
1) note there is not much of difference in bash/sh
2) puppet