Running Puppet HelloWorld on CentOS 6.3
Puppet is a very well-known configuration management tool that has been adopted by many enterprises and service providers. VMware recently invested $30M in Puppet Labs, the company behind it. It’s clear that VMware needs such a tool if it wants to grow in data center space.
I actually got a book from last year’s PuppetConf in San Francisco and browsed through it on my flights. As with any other technology, reading it does not mean getting it. To get my hands dirty, I played with it in my home lab last week.
Time to learn how to "Google" and manage your VMware and clouds in a fast and secure
HTML5 AppBelieve it or not, there are many pages on the Web but very few of them are update to date or accurate. The following are the steps for creating a simple HelloWorld type of example that I had gone through with a few glitches. Hope it works for you too. To its simplest form, the example does not leverage the client/server model but simply show the idea with standalone node.
The starting point of using Puppet is an operating system, be it Linux, Solaris, or Windows. I just picked CentOS as I happened to have a virtual machine template of CentOS 6.3.
Part 1: install puppet and pre-requisites
# rpm -Uvh <a href="http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-6.noarch.rpm">http://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-6.noarch.rpm</a> # rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # yum -y install puppet
Part 2: create a simple module with two files.
# mkdir -p /etc/puppet/modules/helloworld/manifests # vim /etc/puppet/modules/helloworld/manifests/init.pp
Enter the following code.
class helloworld { file { ‘/tmp/helloworld’ : content => “See you at doublecloud.org” } }
Continue with second file calling the first one.
# mkdir -p /etc/puppet/modules/helloworld/tests # vim /etc/puppet/modules/helloworld/tests/init.pp
Enter the following code in editor.
class { 'helloworld': }
Part 3: apply the configuration with a command.
# puppet apply /etc/puppet/modules/helloworld/tests/init.pp
Part 4: Check if the configuration has been applied.
# cat /tmp/helloworld
Now your first Puppet example works. Next is to use Puppet in distributed fashion [Client/Server Mode] which is the norm in real projects.
Running Puppet HelloWorld on CentOS 6.3 (DoubleCloud) http://t.co/KQfKtMp1
Running Puppet HelloWorld on CentOS 6.3 (DoubleCloud) http://t.co/9nJzz3ih
Running Puppet HelloWorld on CentOS 6.3 http://t.co/DFW2x5XJ via @sjin2008
Well explained, thnx
Thanks, Steve! Nice!
One note: I was necessary in my Ubuntu Linux, Puppet 3.1 environment to straighten the curly single and double quotes in the Part 2 example code …