Wednesday, November 2, 2011

How To Install And Configure Puppet (Getting Puppet Up)

Puppet is a system management tool used my many large and small enterprises to manage their infrastructure. From the top of my head Twitter, Wikipedia, Digg, Nokia, Rackspace are some of the companies using it and there is no reason that you cannot use it to manage that single server you love or the entire data center you own.

Installing puppet is not difficult but i"ll recommend installing puppet on Fedora/EL from tmz repo instead of the official repo. Official repo is generally out of date while tmz repo has latest builds. I don't know if some such repo exists for debian-like distributions. If you are interested in installing from source then you should check out this page. Puppet follows client - server architecture. So you need to run a server and a client (which can be on the same machine). Install "puppet" on the client side and "puppet-server" on the server side.

Now let us start with building the server:

Puppet Server
Step 1: Configure tmz repo and install puppet-server

yum install puppet-server

Step 2: Puppet, by default, looks for site.pp file in manifest directory. Let us create one, if not present already.
mkdir /etc/puppet/manifests
touch /etc/puppet/manifests/site.pp

Step 3: Start the puppet master (a.k.a. server) using:
service puppetmaster start

Puppet Client
Step 1: Tell the client where is the server by adding server entry in [main] section:
[main]
server=puppet.aditya.pa

Step 2: Start the puppet client
service puppet start

Puppet client will request a certificate from master. Now let us go to the master and sign the certificate.
You can check out all the signing requests by firing following on puppet master:
puppet cert --list

Sign the correct certificate by:
puppet cert --sign fed1.aditya.pa

Our puppet is up and running and ready to use. I'll build some manifests and modules to manage applications in next post or if you want, you can catch me at Fedora Users and Developers Conference at Pune, India on 6 Novemeber, 2011 where I'll build some manifests and modules live as a part of hackfest event.

5 comments:

  1. Aditya,

    I have seen that your blog are very minimal in nature and lack in depth information.I believe that you are disseminating your understanding to the general public,then please try to put more efforts to make your technical explanation to the mark.

    Yes, it is missing a bit.I know you have good grasp of few thing..but that is not showing up..just become "yet another blog" on GNU/Linux..

    I hope you can understand my point and take measures.

    Enlighten us with your knowledge.Moreover reach more people who really need help on GNU/Linux.

    Thanks,
    Bhaskar

    ReplyDelete
  2. Hey Bhaskar,

    I do agree to this somewhat that my posts lack depth and are very minimal. I write them that way intentionally reason being, I hate reading long posts. I would rather read the documentation than a very long post on a topic.

    Hence my posts are usually small and to the point and for those who want to know more, I include links to more stuff on almost all of my posts, like this post has link to puppetlabs guide.

    This blog is to get people started, not to make them a master. Even I haven't mastered a lot of things I talk about. I am still learning them. :)

    ReplyDelete
  3. Rather than use the TMZ repo, there is also the official Puppet Labs yum repo, yum.puppetlabs.com just install puppetlabs-release and go.

    ReplyDelete
  4. Hi,

    @unixbhaskar aditya's post is nice and wonderful for getting the thing done quickly. However for detailed explanation, you can reffer to the below links(puppet is also available from rpmforge repo).

    http://slashroot.in/puppet-tutorial-how-does-puppet-work
    http://slashroot.in/puppet-tutorial-installing-puppet-master-and-puppet-agent
    http://slashroot.in/puppet-tutorial-configuring-puppet-agent
    http://slashroot.in/documentation


    ReplyDelete
    Replies
    1. i get the following error when starting server:

      Apr 12 10:22:34 localhost.PK5001Z puppet-master[10763]: Could not set 'file' on ensure: Is a directory - /etc/puppet/manifests/site.pp
      Apr 12 10:22:34 localhost.PK5001Z puppet-master[10763]: Wrapped exception:
      Apr 12 10:22:34 localhost.PK5001Z puppet-master[10763]: Is a directory - /etc/puppet/manifests/site.pp
      Apr 12 10:22:34 localhost.PK5001Z puppet-master[10763]: (/File[/etc/puppet/manifests/site.pp]/ensure) change from directory to file failed: Co
      Apr 12 10:22:34 localhost.PK5001Z puppet-master[10763]: Could not prepare for execution: Got 3 failure(s) while initializing: Could not set 'f
      Apr 12 10:22:34 localhost.PK5001Z puppet-master[10763]: Wrapped exception:
      Apr 12 10:22:34 localhost.PK5001Z puppet-master[10763]: Is a directory - /etc/puppet/manifests/site.pp; change from directory to file failed:
      Apr 12 10:22:34 localhost.PK5001Z systemd[1]: puppetmaster.service: control process exited, code=exited status=1
      Apr 12 10:22:34 localhost.PK5001Z systemd[1]: Failed to start Puppet master.

      Delete

Note: Only a member of this blog may post a comment.