Ask Your Question

Keep directory in sync with puppet master?

asked 2013-04-16 00:11:27 -0600

Red Cricket gravatar image

I would like to create a class that keeps the perl lib in sync with the copy on some other server (the puppet master for example). Here is my attempt based on the doc I found here:

class base {
    package { role-Perl:
            ensure => present,

    file { "/opt/perl/lib" :
                    source  =>      "puppet://my-master/opt/perl/lib"
            ,       recurse =>      true
            ,       purge   =>      true

But when I assign this class to my-agent and puppet runs I get these errors ...

Apr 16 00:56:34 my-agent puppet-agent[28518]: (/Stage[main]/Base/File[/opt/perl/lib]) Failed to generate additional resources ...
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-04-16 02:11:10 -0600

Ancillas gravatar image

updated 2013-04-16 02:11:44 -0600

Here's a Puppet Style Guide for formatting your code.

What's in your fileserver.conf file?

It looks like you're using the source parameter wrong.

You can specify a mount point that has been created in fileserver.conf, or you can specify the files directory in a module.

The Mount-Point Syntax


  path /path/on/master/to/files


file {'/opt/perl/lib':
  ensure  => directory,
  recurse => true,
  purge   => true,
  source  => 'puppet:///your-mount/perl-directory',

The Module Syntax

When using a module, you can create a files directory within the module directory to store files that are ... (more)

edit flag offensive delete link more


Thanks for the great response. It turns out that what I really need to do is verify that RPM's that belong to a particular group have not had their ...(more)

Red Cricket gravatar imageRed Cricket ( 2013-04-16 12:01:45 -0600 )edit

It's a shame the file resource type doesn't use rsync. It's incredibly slow and resource intensive when keeping hundreds of files in sync. What is the recommendation ...(more)

richleahy gravatar imagerichleahy ( 2014-01-15 04:58:41 -0600 )edit

I don't know that there's a single accepted way, but my approach would depend on the use case. If the files were treated like deploys, with changes happening ...(more)

Ancillas gravatar imageAncillas ( 2014-01-24 10:57:04 -0600 )edit

answered 2013-04-16 01:57:03 -0600

jonn gravatar image

updated 2013-04-16 02:00:57 -0600

Puppet doesn't permit access to arbitrary files on the puppet master by default; generally speaking, it assumes that the files you want to manage are located within modules.

If you need to manage files that are located outside of modules on the puppet master, then you need to add some configuration to the fileserver as described here. For example, with this in your fileserver.conf:

  path /opt/perl/lib
  allow *
  deny *

you could use this as a source:

source  => "puppet://my-master/perllib"

However, I would try really hard to avoid this if you can ... (more)

edit flag offensive delete link more


Thanks for reply. It turns out that what I really need to manage is the RPM's that are installed (or should be installed) on a given system.

Red Cricket gravatar imageRed Cricket ( 2013-04-16 12:02:56 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-04-16 00:11:27 -0600

Seen: 10,693 times

Last updated: Jan 15 '14