Puppet User and Group Configuration Example


1) Create a user node "UT-9c8e99e3959e"{         user { 'john':         ensure   => 'present',         managehome => true,         password => '$6$gQtfKwwf$riyyLGkm2EtsUjkG03SPhE/PfcrmqDaTrZ1kayHao8s3J1xr8WuC3gWdceFu1RGfCOslh5jSDy8x4xeVx3xYc/'         } } Example: generic@UT-9c8e99e3959e:~$ cat /etc/passwd | grep john generic@UT-9c8e99e3959e:~$ sudo puppet agent --test info: Caching catalog for ut-9c8e99e3959e info: Applying configuration version '1362628656' notice: /Stage[main]//Node[ut-9c8e99e3959e]/User[john]/ensure: created notice: Finished catalog run in … Continue reading Puppet User and Group Configuration Example

Puppet Service Configuration Example


1) Ensure service is always running node "UT-9c8e99e3959e"{ service { "cron":         enable => true,         ensure => "running",         } }   Example: generic@UT-9c8e99e3959e:~$ sudo service cron status cron stop/waiting generic@UT-9c8e99e3959e:~$ sudo puppet agent --test info: Caching catalog for ut-9c8e99e3959e info: Applying configuration version '1362528911' notice: /Stage[main]//Node[ut-9c8e99e3959e]/Service[cron]/ensure: ensure changed 'stopped' … Continue reading Puppet Service Configuration Example

Puppet Remote Execution Configuration Example


1) Download a file node "UT-9c8e99e3959e"{ exec { "download": command => "/usr/bin/wget http://jackiechen.org -O /tmp/test_directory/jc"} } Example: generic@UT-9c8e99e3959e:/tmp/test_directory$ ls generic@UT-9c8e99e3959e:/tmp/test_directory$ sudo puppet agent --test info: Caching catalog for ut-9c8e99e3959e info: Applying configuration version '1361676600' notice: /Stage[main]//Node[ut-9c8e99e3959e]/Exec[download]/returns: executed successfully notice: Finished catalog run in 1.83 seconds generic@UT-9c8e99e3959e:/tmp/test_directory$ ls jc 2) Output to a file node "UT-9c8e99e3959e"{ … Continue reading Puppet Remote Execution Configuration Example

Puppet Host File Configuration Example


1) Add a new host entry node "UT-9c8e99e3959e"{ host { 'ntp.my.lab': ip => '1.1.1.1', host_aliases => 'time',} } Example: generic@UT-9c8e99e3959e:~$ cat /etc/hosts 127.0.0.1 localhost 127.0.0.1 UT-9c8e99e3959e generic@UT-9c8e99e3959e:~$ sudo puppet agent --test info: Caching catalog for ut-9c8e99e3959e info: Applying configuration version '1361667399' notice: /Stage[main]//Node[ut-9c8e99e3959e]/Host[ntp.my.lab]/ensure: created info: FileBucket adding {md5}4a09e9bcef41c5b11f2f9cd84d4226df notice: Finished catalog run in 0.02 seconds … Continue reading Puppet Host File Configuration Example

Puppet File Configuration Example


1) Create a new directory or file (with content) node "UT-9c8e99e3959e"{ file { "/tmp/test_directory": ensure => "directory", owner  => "root", group  => "root", mode   => 755,} file { "/tmp/test_directory/test_file": ensure => "present", content => "puppet test" owner  => "jchen", group  => "jchen", mode   => 755,} } Example: generic@UT-9c8e99e3959e:/tmp$ sudo puppet agent --test info: Caching catalog … Continue reading Puppet File Configuration Example