module-common/manifests/defines/module_dir.pp

42 lines
1.3 KiB
ObjectPascal
Raw Normal View History

# common/manifests/defines/modules_dir.pp -- create a default directory
# for storing module specific information
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Usage:
2010-05-07 22:55:38 +02:00
# include common::moduledir
# 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": }
define module_dir (
$mode = 0644, $owner = root, $group = 0
)
{
include common::moduledir
2010-05-09 23:10:05 +02:00
$dir = "${common::moduledir::module_dir_path}/${name}"
if defined(File[$dir]) {
debug("${dir} already defined")
} else {
file {
$dir:
source => [ "puppet://$server/modules/${name}/modules_dir", "puppet://$server/modules/common/empty"],
checksum => mtime,
# ignore the placeholder
2010-08-02 01:53:41 +02:00
ignore => '.ignore',
recurse => true, purge => true, force => true,
mode => $mode, owner => $owner, group => $group;
}
}
}
2009-12-09 23:57:37 +01:00
# alias for compatibility
define modules_dir (
$mode = 0644, $owner = root, $group = 0
)
2009-12-09 23:57:37 +01:00
{
module_dir { $name: mode => $mode, owner => $owner, group => $group }
2009-12-09 23:57:37 +01:00
}