Thursday, May 6, 2010

Being a file server?

One thing that I like a lot about puppet is it's ability to act as the source of configuration hence being the head honcho is a configuration management setup. Setting this baby up though required much patience as the docs needed some maneuvering.

Okay here goes. Inside the default configuration, there is a file called fileserver.conf which describes the behavior of the puppet master server acting as a fileserver or source of configuration files. This file was not present in my opensuse package. So all I had to do was to create the file in /etc/puppet/. Okay say you wanted as most of the examples state be a source of the sudoers file. This means that any server connected to the network with the puppet client installed will pull the sudoers file from the main server.

site.pp has to be configured as so:

class sudo{
file { "/tmp/sudoersxxx":
        owner => root,
        group => root,
        mode => 440,
        source => "puppet://robot-ng/files/sudoersxxx"
    }}


Here I purposely picked /tmp so that it will not effect the real sudoers file since we are just doing a quick test to see if our configuration works. Okay so far so good. Let's get to the good part where it had me typing furiously not to mention tearing out my hair follicles at the same time. Notice the part "source => 'puppet://robot-ng/files/sudoersxxx'". I will tell you my understanding of this as the docs and examples put in good olde' spinning confusion for hours and hours. To the server this part means that, expect to find the source file from a server called "robot-ng". The source file itself is called 'sudoersxxx', as for the path that the file is kept, this config is telling puppet master to peek into the fileserver.conf configuration file and look up the path under a section called 'files'. So, in the fileserver.conf file I put this:

[files]
    path /etc/puppet/files/dist/apps/sudo/
    allow *

When puppet master finds this, it will follow the path to fetch the configuration file. The next bit of the allow is to specify which host is allowed to get this file. I have covered what I think is the most confusing of the configuration management source file examples, so hopefully less of your fingernails will be embedded in your scalp trying to get this to work compared to me :).

No comments:

Post a Comment