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


No comments:

Post a Comment