Monday, June 3, 2013

[how to]:: Install puppet

Ok so my first puppet post was a little advanced, so I thought maybe I should start with the basics of puppet. Puppet starts getting pretty awesome as soon as you need to manage more than 5 servers and over 60 virtual hosts, spread across various servers. But before we proceed, lets install puppet and run our first puppet script!


Installation:

Assuming you have CentOS, you'll need to add the correct puppetlabs yum repositories. This can be done by using the following command,


# rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm

Once installed, you need to use yum to install puppet and puppet server.



# yum install puppet puppet-server

Confirm that puppet is installed by running,
# puppet --version
3.2.1


Lets start with create a basic puppet script to create a file called test.pp and add the following text to it,

## test.pp
file {"/tmp/test":
 ensure => file,
 owner => root,
 group => root,
 content => "hello im a file",
 mode => 644,
}

To apply this script you will need to run puppet with the following command,


# puppet apply test.pp 
Notice: /Stage[main]//File[/tmp/test]/ensure: defined content as '{md5}e32d2cadd86f222aa80e3fd11d22d0cd'
Notice: Finished catalog run in 0.08 seconds

Great, from the Notice you can see that a file was created under /tmp/test. You can cat the file to confirm the content "hello im a file".


Next post we will be moving this test.pp to the puppet master, add a server to puppet master and then create the /tmp/test file on the client server.




Cheers,

Dan

No comments:

Post a Comment