Solution to managing an entire directory in a "waterfall" configuration

1 view
Skip to first unread message

Eiwe Lingefors

unread,
Nov 5, 2008, 2:33:25 PM11/5/08
to Puppet Users
The subject may not make a lot of sense so let me try and explain.
I've searched the archives and come up short so my apologies if this
has indeed been addressed before.

I have a function that looks like this:

define remotedir($mode, $owner, $group, $source, $ensure = directory,
$recurse = inf) {
file {
$name:
mode => $mode,
owner => $owner,
group => $group,
ensure => $ensure,
recurse => $recurse,
source => [
"puppet://$server/dist/host/$host/$source",
"puppet://$server/dist/farm/$farm/$source",
"puppet://$server/dist/colo/$colo/$type/
$source",
"puppet://$server/dist/colo/$colo/common/
$source",
"puppet://$server/dist/type/$type/$source",
"puppet://$server/dist/type/common/$source"
]
}
}

It works great and as expected it prefers files higher up in the list.
However, I would like the "common" files (at the bottom of the list)
to always be included. I have not found a way to accomplish this since
in its present form it won't ever get there since it prefers files
higher in the list.

If I create a function to grab the common files I end up with a
collision since both functions then try to manage the same directory.
I would like to try to avoid managing individual files.

For example, we have a bunch of custom scripts in /usr/local/sbin and
right now a class like this:

class farm_localsbin {
remotedir { "/usr/local/sbin":
source => "usr/local/sbin",
mode => 755,
owner => root,
group => root;
}
}

This gets included from the node definition and grabs all the /usr/
local/sbin/* files specific to that "farm" as would be expected. It
does NOT grab the "common" files like I would want, due to the
aforementioned issues.

Do you understand what I'm rambling on about? Is there a way to
accomplish this? Please let me know if you need any further
clarification or examples and I'll be happy to provide it.

Thanks,
Eiwe Lingefors
Reply all
Reply to author
Forward
0 new messages