Configuring Puppet for File-Sharing

Note: So far this procedure had been developed and tested only on CentOS 5.0, therefore it may be completely unsuitable for other operating systems including RHEL5.

One way to enable Puppet to install files of the servers it manages is to have it serve the files with its built-in server.

The file server works by defining “modules” which abstract the underlying file system structure similar manner to the way Samba shares do, configuring the file server is a simple manner of defining the proper modules in the file /etc/puppet/fileserver.conf and restarting the puppetmasterd.

A typical configuration of a dotfiles module looks as follows:

  path /var/lib/puppet/dotfiles
  # needed to allow local puppetd

Where path (obviously) denotes where the shared files are, and allow determines who can access the files.

Access to the files is controlled by deny and allow directives which work in quite similar fashion to the way similar directives work in apache or in the /etc/hosts.allow and /etc/hosts.deny files.

One critical difference of puppet’s allow and deny directives is that deny takes precedence over allow.

In order to use a file share by the puppet file server you specify a puppet URL as a value of a source attribute of a file resource, for example, to pull the file form the module dotfiles on the server pmaster:

source  => "puppet://pmaster/dotfiles/"

You can omit the server hostname to have puppet download automatically from the puppetmaster e.g:

source  => "puppet:///dotfiles/"

3 thoughts on “Configuring Puppet for File-Sharing

  1. I’m not quite sure I understand what you are trying to do.
    Also note that this post is very VERY old, way before I really understood what Puppet modules are and how do they work. You don’t really have to do much configuration for the file server, you just write your Puppet code using modules, place the files inside the “files” directory in your module and use them like this:

    source => “puppet:///modules/”

    If you want to use different files for different hosts I suppose you can do this:

    source => “puppet:///modules/$”

    And place one file for each host inside your module. You can also do this:

    source => [

    To have a default fall-back file.

    Note that if you have to include a different file in your configuration per-server , you might be better off using a template instead of a plain file and using the ERB syntax to account for the differences between the servers.

    The Puppet documentation today is much much better then it used to be, take a look here:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s