Ask Your Question
0

Keep directory in sync with puppet master?

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

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: http://docs.puppetlabs.com/guides/techniques.html#how-can-i-manage-whole-directories-of-files-without-explicitly-listing-the-files

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 ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

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

Ancillas gravatar image

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

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

fileserver.conf

[your-mount]
  path /path/on/master/to/files

yourmanifest.pp

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

Comments

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 -0500 )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 -0500 )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 -0500 )edit
2

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

jonn gravatar image

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

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:

[perllib]
  path /opt/perl/lib
  allow *.goodguys.com
  deny *.badguys.com

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

Comments

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 -0500 )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

Stats

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

Seen: 8,832 times

Last updated: Jan 15 '14