2007-08-01 13:25:27 +02:00
|
|
|
# common/manifests/defines/modules_dir.pp -- create a default directory
|
2009-05-31 21:14:37 +02:00
|
|
|
# for storing module specific information
|
|
|
|
#
|
|
|
|
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
|
|
|
|
# See LICENSE for the full license granted to you.
|
|
|
|
|
|
|
|
# A module_dir is a storage place for all the stuff a module might want to
|
|
|
|
# store. According to the FHS, this should go to /var/lib. Since this is a part
|
|
|
|
# of puppet, the full path is /var/lib/puppet/modules/${name}. Every module
|
|
|
|
# should # prefix its module_dirs with its name.
|
|
|
|
#
|
2009-11-28 03:58:39 +01:00
|
|
|
# By default, the module_dir is loaded from "puppet:///${name}/module_dir". If
|
2009-06-09 17:51:10 +02:00
|
|
|
# that doesn't exist an empty directory is taken as source. The directory is
|
2009-05-31 21:14:37 +02:00
|
|
|
# purged so that modules do not have to worry about removing cruft.
|
|
|
|
#
|
|
|
|
# Usage:
|
2010-05-07 22:55:38 +02:00
|
|
|
# include common::moduledir
|
2010-05-07 23:13:48 +02:00
|
|
|
# module_dir { ["common", "common/dir1", "common/dir2" ]: }
|
2010-05-07 22:55:38 +02:00
|
|
|
#
|
|
|
|
# You may refer to a file in module_dir by using :
|
|
|
|
# file { "${common::moduledir::module_dir_path}/somedir/somefile": }
|
|
|
|
|
2009-05-31 21:14:37 +02:00
|
|
|
define module_dir (
|
2010-05-07 23:38:15 +02:00
|
|
|
$mode = 0644, $owner = root, $group = 0
|
|
|
|
)
|
2009-05-31 21:14:37 +02:00
|
|
|
{
|
2010-05-07 23:38:15 +02:00
|
|
|
include common::moduledir
|
2010-05-09 23:10:05 +02:00
|
|
|
$dir = "${common::moduledir::module_dir_path}/${name}"
|
2010-05-07 23:38:15 +02:00
|
|
|
if defined(File[$dir]) {
|
|
|
|
debug("${dir} already defined")
|
|
|
|
} else {
|
|
|
|
file {
|
|
|
|
$dir:
|
|
|
|
checksum => mtime,
|
|
|
|
# ignore the placeholder
|
|
|
|
recurse => true, purge => true, force => true,
|
|
|
|
mode => $mode, owner => $owner, group => $group;
|
|
|
|
}
|
|
|
|
}
|
2009-05-31 21:14:37 +02:00
|
|
|
}
|
|
|
|
|
2009-12-09 23:57:37 +01:00
|
|
|
# alias for compatibility
|
2010-05-07 23:13:48 +02:00
|
|
|
define modules_dir (
|
2010-05-07 23:38:15 +02:00
|
|
|
$mode = 0644, $owner = root, $group = 0
|
|
|
|
)
|
2009-12-09 23:57:37 +01:00
|
|
|
{
|
2010-05-07 23:13:48 +02:00
|
|
|
module_dir { $name: mode => $mode, owner => $owner, group => $group }
|
2009-12-09 23:57:37 +01:00
|
|
|
}
|