aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/functions/gsub.rb14
-rw-r--r--lib/puppet/parser/functions/hostname.rb13
-rw-r--r--lib/puppet/parser/functions/prefix_with.rb14
-rw-r--r--lib/puppet/parser/functions/sha1.rb9
-rw-r--r--lib/puppet/parser/functions/slash_escape.rb7
-rw-r--r--lib/puppet/parser/functions/strlength.rb6
-rw-r--r--lib/puppet/parser/functions/substitute.rb20
-rw-r--r--manifests/classes/lsb_release.pp49
-rw-r--r--manifests/defines/concatenated_file.pp142
-rw-r--r--manifests/defines/config_file.pp71
-rw-r--r--manifests/defines/line.pp33
-rw-r--r--manifests/defines/link.pp12
-rw-r--r--manifests/defines/module_dir.pp54
-rw-r--r--manifests/defines/module_file.pp49
-rw-r--r--manifests/defines/replace.pp29
-rw-r--r--manifests/init.pp19
-rw-r--r--manifests/moduledir.pp15
-rw-r--r--manifests/moduledir/common.pp3
-rw-r--r--manifests/moduledir/common/cf.pp4
19 files changed, 297 insertions, 266 deletions
diff --git a/lib/puppet/parser/functions/gsub.rb b/lib/puppet/parser/functions/gsub.rb
index 27e6192..e2410ff 100644
--- a/lib/puppet/parser/functions/gsub.rb
+++ b/lib/puppet/parser/functions/gsub.rb
@@ -1,13 +1,9 @@
-#
-# A thin wrapper around the ruby gsub function.
-#
-# gsub($string, $pattern, $replacement)
-#
-# will replace all occurrences of $pattern in $string with $replacement.
-# $string can be either a single value or an array. In the latter case, each
-# element of the array will be processed in turn.
-#
module Puppet::Parser::Functions
+ # thin wrapper around the ruby gsub function
+ # gsub($string, $pattern, $replacement) will replace all occurrences of
+ # $pattern in $string with $replacement. $string can be either a singel
+ # value or an array. In the latter case, each element of the array will
+ # be processed in turn.
newfunction(:gsub, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args[0].collect do |val|
diff --git a/lib/puppet/parser/functions/hostname.rb b/lib/puppet/parser/functions/hostname.rb
new file mode 100644
index 0000000..7bc477f
--- /dev/null
+++ b/lib/puppet/parser/functions/hostname.rb
@@ -0,0 +1,13 @@
+# get an uniq array of ipaddresses for a hostname
+require 'resolv'
+
+module Puppet::Parser::Functions
+ newfunction(:hostname, :type => :rvalue) do |args|
+ res = Array.new
+ Resolv::DNS.new.each_address(args[0]){ |addr|
+ res << addr
+ }
+ res.uniq
+ end
+end
+
diff --git a/lib/puppet/parser/functions/prefix_with.rb b/lib/puppet/parser/functions/prefix_with.rb
index 5a12986..6e64a4a 100644
--- a/lib/puppet/parser/functions/prefix_with.rb
+++ b/lib/puppet/parser/functions/prefix_with.rb
@@ -1,15 +1,5 @@
-# Prefixes arguments 2..n with first argument.
-#
-# prefix_with(string prefix, string[] arguments) : string[]
-#
-# Example:
-#
-# prefix_with("php-", [ "blah", "foo" ])
-#
-# will result in this array:
-#
-# [ "php-blah", "php-foo" ]
-#
+# prefix arguments 2..n with first argument
+
module Puppet::Parser::Functions
newfunction(:prefix_with, :type => :rvalue) do |args|
prefix = args.shift
diff --git a/lib/puppet/parser/functions/sha1.rb b/lib/puppet/parser/functions/sha1.rb
new file mode 100644
index 0000000..b5aa813
--- /dev/null
+++ b/lib/puppet/parser/functions/sha1.rb
@@ -0,0 +1,9 @@
+# return the sha1 hash
+require 'digest/sha1'
+
+module Puppet::Parser::Functions
+ newfunction(:sha1, :type => :rvalue) do |args|
+ Digest::SHA1.hexdigest(args[0])
+ end
+end
+
diff --git a/lib/puppet/parser/functions/slash_escape.rb b/lib/puppet/parser/functions/slash_escape.rb
new file mode 100644
index 0000000..04d3b95
--- /dev/null
+++ b/lib/puppet/parser/functions/slash_escape.rb
@@ -0,0 +1,7 @@
+# escape slashes in a String
+module Puppet::Parser::Functions
+ newfunction(:slash_escape, :type => :rvalue) do |args|
+ args[0].gsub(/\//, '\\/')
+ end
+end
+
diff --git a/lib/puppet/parser/functions/strlength.rb b/lib/puppet/parser/functions/strlength.rb
new file mode 100644
index 0000000..147b24a
--- /dev/null
+++ b/lib/puppet/parser/functions/strlength.rb
@@ -0,0 +1,6 @@
+module Puppet::Parser::Functions
+ newfunction(:strlength, :type => :rvalue) do |args|
+ args[0].to_s.length
+ end
+end
+
diff --git a/lib/puppet/parser/functions/substitute.rb b/lib/puppet/parser/functions/substitute.rb
new file mode 100644
index 0000000..4c97def
--- /dev/null
+++ b/lib/puppet/parser/functions/substitute.rb
@@ -0,0 +1,20 @@
+# subsititute($string, $regex, $replacement) : $string
+# subsititute($string[], $regex, $replacement) : $string[]
+#
+# Replace all ocurrences of $regex in $string by $replacement.
+# $regex is interpreted as Ruby regular expression.
+#
+# For long-term portability it is recommended to refrain from using Ruby's
+# extended RE features.
+module Puppet::Parser::Functions
+ newfunction(:substitute, :type => :rvalue) do |args|
+ if args[0].is_a?(Array)
+ args[0].collect do |val|
+ val.gsub(/#{args[1]}/, args[2])
+ end
+ else
+ args[0].gsub(/#{args[1]}/, args[2])
+ end
+ end
+end
+
diff --git a/manifests/classes/lsb_release.pp b/manifests/classes/lsb_release.pp
deleted file mode 100644
index 5745072..0000000
--- a/manifests/classes/lsb_release.pp
+++ /dev/null
@@ -1,49 +0,0 @@
-# common/manifests/classes/lsb_release.pp -- request the installation of
-# lsb_release to get to lsbdistcodename, which is used throughout the manifests
-#
-# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
-# See LICENSE for the full license granted to you.
-
-# Changelog:
-# 2007-08-26: micah <micah@riseup.net> reported, that lsb_release can report
-# nonsensical values for lsbdistcodename; assert_lsbdistcodename now
-# recognises "n/a" and acts accordingly
-
-# This lightweight class only asserts that $lsbdistcodename is set.
-# If the assertion fails, an error is printed on the server
-#
-# To fail individual resources on a missing lsbdistcodename, require
-# Exec[assert_lsbdistcodename] on the specific resource
-#
-# This is just one example of how you could avoid evaluation of parts of the
-# manifest, before a bootstrapping class has enabled all the necessary goodies.
-class assert_lsbdistcodename {
-
- case $lsbdistcodename {
- '': {
- err("Please install lsb_release or set facter_lsbdistcodename in the environment of $fqdn")
- exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename, loglevel => err }
- }
- 'n/a': {
- case $operatingsystem {
- "Debian": {
- err("lsb_release was unable to report your distcodename; This seems to indicate a broken apt/sources.list on $fqdn")
- }
- default: {
- err("lsb_release was unable to report your distcodename; please set facter_lsbdistcodename in the environment of $fqdn")
- }
- }
- exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename, loglevel => err }
- }
- default: {
- exec { "true # assert_lsbdistcodename": alias => assert_lsbdistcodename, loglevel => debug }
- exec { "true # require_lsbdistcodename": alias => require_lsbdistcodename, loglevel => debug }
- }
- }
-
-}
-
-# To fail the complete compilation on a missing $lsbdistcodename, include this class
-class require_lsbdistcodename inherits assert_lsbdistcodename {
- exec { "false # require_lsbdistcodename": require => Exec[require_lsbdistcodename], loglevel => err }
-}
diff --git a/manifests/defines/concatenated_file.pp b/manifests/defines/concatenated_file.pp
index b85456c..491e2c8 100644
--- a/manifests/defines/concatenated_file.pp
+++ b/manifests/defines/concatenated_file.pp
@@ -4,8 +4,6 @@
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
-module_dir { "common/cf": }
-
# TODO:
# * create the directory in _part too
@@ -24,77 +22,78 @@ module_dir { "common/cf": }
#
# Depend on File[$name] to change if and only if its contents change. Notify
# Exec["concat_${name}"] if you want to force an update.
-#
+#
# Usage:
# concatenated_file { "/etc/some.conf":
-# dir => "/etc/some.conf.d",
+# dir => "/etc/some.conf.d",
# }
define concatenated_file (
- # where the snippets are located
- $dir = '',
- # a file with content to prepend
- $header = '',
- # a file with content to append
- $footer = '',
- # default permissions for the target file
- $mode = 0644, $owner = root, $group = 0
- )
+ # where the snippets are located
+ $dir = '',
+ # a file with content to prepend
+ $header = '',
+ # a file with content to append
+ $footer = '',
+ # default permissions for the target file
+ $mode = 0644, $owner = root, $group = 0
+ )
{
+ include common::moduledir::common::cf
- $dir_real = $dir ? { '' => "${name}.d", default => $dir }
+ $dir_real = $dir ? { '' => "${name}.d", default => $dir }
- $tmp_file_name = regsubst($dir_real, '/', '_', 'G')
- $tmp_file = "${module_dir_path}/${tmp_file_name}"
+ $tmp_file_name = regsubst($dir_real, '/', '_', 'G')
+ $tmp_file = "${common::moduledir::module_dir_path}/${tmp_file_name}"
- if defined(File[$dir_real]) {
- debug("${dir_real} already defined")
- } else {
- file {
- $dir_real:
- source => "puppet://$server/modules/common/empty",
- checksum => mtime,
- ignore => '.ignore',
- recurse => true, purge => true, force => true,
- mode => $mode, owner => $owner, group => $group,
- notify => Exec["concat_${name}"];
- }
- }
+ if defined(File[$dir_real]) {
+ debug("${dir_real} already defined")
+ } else {
+ file {
+ $dir_real:
+ source => "puppet:///modules/common/empty",
+ checksum => mtime,
+ ignore => '.ignore',
+ recurse => true, purge => true, force => true,
+ mode => $mode, owner => $owner, group => $group,
+ notify => Exec["concat_${name}"];
+ }
+ }
- file {
- $tmp_file:
- ensure => present, checksum => md5,
- mode => $mode, owner => $owner, group => $group;
- # decouple the actual file from the generation process by using a
- # temporary file and puppet's source mechanism. This ensures that events
- # for notify/subscribe will only be generated when there is an actual
- # change.
- $name:
- ensure => present, checksum => md5,
- source => $tmp_file,
- mode => $mode, owner => $owner, group => $group,
- require => File[$tmp_file];
- }
+ file {
+ $tmp_file:
+ ensure => present, checksum => md5,
+ mode => $mode, owner => $owner, group => $group;
+ # decouple the actual file from the generation process by using a
+ # temporary file and puppet's source mechanism. This ensures that events
+ # for notify/subscribe will only be generated when there is an actual
+ # change.
+ $name:
+ ensure => present, checksum => md5,
+ source => $tmp_file,
+ mode => $mode, owner => $owner, group => $group,
+ require => File[$tmp_file];
+ }
- # if there is a header or footer file, add it
- $additional_cmd = $header ? {
- '' => $footer ? {
- '' => '',
- default => "| cat - '${footer}' "
- },
- default => $footer ? {
- '' => "| cat '${header}' - ",
- default => "| cat '${header}' - '${footer}' "
- }
- }
+ # if there is a header or footer file, add it
+ $additional_cmd = $header ? {
+ '' => $footer ? {
+ '' => '',
+ default => "| cat - '${footer}' "
+ },
+ default => $footer ? {
+ '' => "| cat '${header}' - ",
+ default => "| cat '${header}' - '${footer}' "
+ }
+ }
- # use >| to force clobbering the target file
- exec { "concat_${name}":
- command => "/usr/bin/find ${dir_real} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${additional_cmd} >| ${tmp_file}",
- subscribe => [ File[$dir_real] ],
- before => File[$tmp_file],
- alias => [ "concat_${dir_real}"],
- loglevel => info
- }
+ # use >| to force clobbering the target file
+ exec { "concat_${name}":
+ command => "/usr/bin/find ${dir_real} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${additional_cmd} >| ${tmp_file}",
+ subscribe => [ File[$dir_real] ],
+ before => File[$tmp_file],
+ alias => [ "concat_${dir_real}"],
+ loglevel => info
+ }
}
@@ -102,16 +101,17 @@ define concatenated_file (
# Add a snippet called $name to the concatenated_file at $dir.
# The file can be referenced as File["cf_part_${name}"]
define concatenated_file_part (
- $dir, $content = '', $ensure = present,
- $mode = 0644, $owner = root, $group = 0
- )
+ $dir, $content = '', $ensure = present,
+ $mode = 0644, $owner = root, $group = 0
+ )
{
- file { "${dir}/${name}":
- ensure => $ensure, content => $content,
- mode => $mode, owner => $owner, group => $group,
- alias => "cf_part_${name}",
- notify => Exec["concat_${dir}"],
- }
+ file { "${dir}/${name}":
+ ensure => $ensure, content => $content,
+ mode => $mode, owner => $owner, group => $group,
+ alias => "cf_part_${name}",
+ notify => Exec["concat_${dir}"],
+ }
}
+
diff --git a/manifests/defines/config_file.pp b/manifests/defines/config_file.pp
index 781e9ec..d624c10 100644
--- a/manifests/defines/config_file.pp
+++ b/manifests/defines/config_file.pp
@@ -3,56 +3,53 @@
# See LICENSE for the full license granted to you.
# A simple wrapper to give all configuration files common defaults.
-#
+#
# Usage:
-# config_file { filename:
-# content => "....\n",
-# }
+# config_file { filename:
+# content => "....\n",
+# }
#
-# Examples:
+# Examples:
#
# To create the file /etc/vservers/${vs_name}/context with specific
# content:
#
-# config_file {
-# "/etc/vservers/${vs_name}/context":
-# content => "${context}\n",
-# notify => Exec["vs_restart_${vs_name}"],
-# require => Exec["vs_create_${vs_name}"];
+# config_file { "/etc/vservers/${vs_name}/context":
+# content => "${context}\n",
+# notify => Exec["vs_restart_${vs_name}"],
+# require => Exec["vs_create_${vs_name}"];
# }
#
# To create the file /etc/apache2/sites-available/munin-stats with the
# content pulled from a template:
#
-# config_file {
-# "/etc/apache2/sites-available/munin-stats":
-# content => template("apache/munin-stats"),
-# require => Package["apache2"],
-# notify => Exec["reload-apache2"];
-# }
-define config_file (
- $content = '',
- $source = '',
- $ensure = 'present')
-{
- file { $name:
- ensure => $ensure,
- # default permissions for config files
- mode => 0644, owner => root, group => 0,
- # really detect changes to this file
- checksum => md5,
- }
+# config_file { "/etc/apache2/sites-available/munin-stats":
+# content => template("apache/munin-stats"),
+# require => Package["apache2"],
+# notify => Exec["reload-apache2"]
+# }
+
+define config_file ($content = '', $source = '', $ensure = 'present') {
+ file { $name:
+ ensure => $ensure,
+ # keep old versions on the server
+ backup => server,
+ # default permissions for config files
+ mode => 0644, owner => root, group => 0,
+ # really detect changes to this file
+ checksum => md5,
+ }
+
+ case $source {
+ '': { }
+ default: { File[$name] { source => $source } }
+ }
- case $source {
- '': { }
- default: { File[$name] { source => $source } }
- }
+ case $content {
+ '': { }
+ default: { File[$name] { content => $content } }
+ }
- case $content {
- '': { }
- default: { File[$name] { content => $content } }
- }
-
}
diff --git a/manifests/defines/line.pp b/manifests/defines/line.pp
index bc2ece4..ccfa357 100644
--- a/manifests/defines/line.pp
+++ b/manifests/defines/line.pp
@@ -34,24 +34,21 @@
# notify => Service[munin-node],
# require => Package[munin-node];
# }
-define line(
- $file,
- $line,
- $ensure = 'present'
-) {
- case $ensure {
- default : { err ( "unknown ensure value '${ensure}'" ) }
- present: {
- exec { "echo '${line}' >> '${file}'":
- unless => "grep -qFx '${line}' '${file}'"
- }
- }
- absent: {
- exec { "perl -ni -e 'print if \$_ ne \"${line}\n\";' '${file}'":
- onlyif => "grep -qFx '${line}' '${file}'"
- }
- }
- }
+define line($file, $line, $ensure = 'present') {
+ case $ensure {
+ default : { err ( "unknown ensure value '${ensure}'" ) }
+ present: {
+ exec { "echo '${line}' >> '${file}'":
+ unless => "grep -qFx '${line}' '${file}'"
+ }
+ }
+ absent: {
+ $subst_line = regsubst($line,'(/|\.)','\\\1','G')
+ exec { "sed -i '/${subst_line}/d' '${file}'":
+ onlyif => "grep -qFx '${line}' '${file}'"
+ }
+ }
+ }
}
diff --git a/manifests/defines/link.pp b/manifests/defines/link.pp
new file mode 100644
index 0000000..e8e4a9f
--- /dev/null
+++ b/manifests/defines/link.pp
@@ -0,0 +1,12 @@
+# common/manifests/defines/link.pp -- create a link
+#
+# Copyleft (C) 2009 immerdaadmin <admin@immerda.ch>
+# See LICENSE for the full license granted to you.
+
+# Usage:
+# link { "/usr/bin/convert": target => "/usr/local/bin/convert" }
+# e.g. equivalent to bash# ln -s /usr/bin/convert /usr/local/bin/convert
+
+define link($target = absent) {
+ file{$name: ensure => $target; }
+}
diff --git a/manifests/defines/module_dir.pp b/manifests/defines/module_dir.pp
index def5c94..227fe71 100644
--- a/manifests/defines/module_dir.pp
+++ b/manifests/defines/module_dir.pp
@@ -1,4 +1,4 @@
-# common/manifests/defines/module_dir.pp -- create a default directory
+# 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>
@@ -14,29 +14,37 @@
# purged so that modules do not have to worry about removing cruft.
#
# Usage:
-# module_dir { ["common", "common/dir1", "common/dir2" ]: }
+# include common::moduledir
+# module_dir { ["common", "common/dir1", "common/dir2" ]: }
+#
+# 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
- )
+ $mode = 0644, $owner = root, $group = 0
+ )
{
- $dir = "${module_dir_path}/${name}"
- if defined(File[$dir]) {
- debug("${dir} already defined")
- } else {
- file {
- $dir:
- source => [ "puppet://$server/modules/${name}/module_dir", "puppet://$server/modules/common/empty"],
- checksum => mtime,
- # ignore the placeholder
- ignore => '\.ignore',
- recurse => true, purge => true, force => true,
- mode => $mode, owner => $owner, group => $group;
- }
- }
+ include common::moduledir
+ $dir = "${common::moduledir::module_dir_path}/${name}"
+ if defined(File[$dir]) {
+ debug("${dir} already defined")
+ } else {
+ file {
+ $dir:
+ source => [ "puppet:///modules/${name}/modules_dir", "puppet:///modules/common/empty"],
+ checksum => mtime,
+ # ignore the placeholder
+ ignore => '.ignore',
+ recurse => true, purge => true, force => true,
+ mode => $mode, owner => $owner, group => $group;
+ }
+ }
}
-# Use this variable to reference the base path. Thus you are safe from any
-# changes.
-$module_dir_path = '/var/lib/puppet/modules'
+# alias for compatibility
+define modules_dir (
+ $mode = 0644, $owner = root, $group = 0
+ )
+{
+ module_dir { $name: mode => $mode, owner => $owner, group => $group }
+}
diff --git a/manifests/defines/module_file.pp b/manifests/defines/module_file.pp
index 9074589..70e5cbf 100644
--- a/manifests/defines/module_file.pp
+++ b/manifests/defines/module_file.pp
@@ -1,5 +1,5 @@
-# common/manifests/defines/module_file.pp -- use an already defined module_dir
-# to store module specific files
+# common/manifests/defines/modules_file.pp -- use a modules_dir to store module
+# specific files
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
@@ -7,18 +7,41 @@
# Put a file into module-local storage.
#
# Usage:
-# module_file {
-# "module/file":
-# source => "puppet://..",
+# modules_file { "module/file":
+# source => "puppet:///...",
+# mode => 644, # default
+# owner => root, # default
+# group => 0, # default
# }
define module_file (
- $source,
- $mode = 0644, $owner = root, $group = 0
- )
+ $source,
+ $ensure = present,
+ $alias = undef,
+ $mode = 0644, $owner = root, $group = 0
+ )
{
- file {
- "${module_dir_path}/${name}":
- source => $source,
- mode => $mode, owner => $owner, group => $group;
- }
+ include common::moduledir
+ file {
+ "${common::moduledir::module_dir_path}/${name}":
+ source => $source,
+ ensure => $ensure,
+ alias => $alias,
+ mode => $mode, owner => $owner, group => $group;
+ }
+}
+
+# alias for compatibility
+define modules_file (
+ $source,
+ $ensure = present,
+ $alias = undef,
+ $mode = 0644, $owner = root, $group = 0
+ )
+{
+ module_file { $name:
+ source => $source,
+ ensure => $ensure,
+ alias => $alias,
+ mode => $mode, owner => $owner, group => $group
+ }
}
diff --git a/manifests/defines/replace.pp b/manifests/defines/replace.pp
index c9a98bd..f7da3b4 100644
--- a/manifests/defines/replace.pp
+++ b/manifests/defines/replace.pp
@@ -14,7 +14,7 @@
#
# Usage:
#
-# replace { description:
+# replace { description:
# file => "filename",
# pattern => "regexp",
# replacement => "replacement"
@@ -23,19 +23,18 @@
# To replace the current port in /etc/munin/munin-node.conf
# with a new port, but only disturbing the file when needed:
#
-# replace {
-# set_munin_node_port:
-# file => "/etc/munin/munin-node.conf",
-# pattern => "^port (?!$port)[0-9]*",
-# replacement => "port $port"
-# }
-define replace($file, $pattern, $replacement) {
- $pattern_no_slashes = regsubst($pattern, '/', '\\/', 'G', 'U')
- $replacement_no_slashes = regsubst($replacement, '/', '\\/', 'G', 'U')
+# replace { set_munin_node_port:
+# file => "/etc/munin/munin-node.conf",
+# pattern => "^port (?!$port)[0-9]*",
+# replacement => "port $port"
+# }
- exec { "replace_${pattern}_${file}":
- command => "/usr/bin/perl -pi -e 's/${pattern_no_slashes}/${replacement_no_slashes}/' '${file}'",
- onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /${pattern_no_slashes}/ && ! /\\Q${replacement_no_slashes}\\E/; END { exit \$ret; }' '${file}'",
- alias => "exec_$name",
- }
+define replace($file, $pattern, $replacement) {
+ $pattern_no_slashes = slash_escape($pattern)
+ $replacement_no_slashes = slash_escape($replacement)
+ exec { "replace_${pattern}_${file}":
+ command => "/usr/bin/perl -pi -e 's/${pattern_no_slashes}/${replacement_no_slashes}/' '${file}'",
+ onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /${pattern_no_slashes}/ && ! /\\Q${replacement_no_slashes}\\E/; END { exit \$ret; }' '${file}'",
+ alias => "exec_$name",
+ }
}
diff --git a/manifests/init.pp b/manifests/init.pp
index f767030..3a9faf5 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -3,23 +3,4 @@
# See LICENSE for the full license granted to you.
import "defines/*.pp"
-import "classes/*.pp"
-
-module_dir { [ 'common' ]: }
-
-file {
- # Module programmers can use /var/lib/puppet/modules/$modulename to save
- # module-local data, e.g. for constructing config files. See module_dir
- # for details
- "/var/lib/puppet/modules":
- ensure => directory,
- source => "puppet://$server/modules/common/modules",
- ignore => ".ignore",
- recurse => true, purge => true, force => true,
- mode => 0755, owner => root, group => 0;
-}
-
-# common packages
-class pkg::openssl { package { openssl: ensure => installed } }
-class pkg::rsync { package { rsync: ensure => installed } }
diff --git a/manifests/moduledir.pp b/manifests/moduledir.pp
new file mode 100644
index 0000000..df83e60
--- /dev/null
+++ b/manifests/moduledir.pp
@@ -0,0 +1,15 @@
+class common::moduledir {
+ # Use this variable to reference the base path. Thus you are safe from any
+ # changes.
+ $module_dir_path = '/var/lib/puppet/modules'
+
+ # Module programmers can use /var/lib/puppet/modules/$modulename to save
+ # module-local data, e.g. for constructing config files
+ file{$module_dir_path:
+ ensure => directory,
+ source => "puppet:///modules/common/modules/",
+ ignore => '.ignore',
+ recurse => true, purge => true, force => true,
+ mode => 0755, owner => root, group => 0;
+ }
+}
diff --git a/manifests/moduledir/common.pp b/manifests/moduledir/common.pp
new file mode 100644
index 0000000..c615f84
--- /dev/null
+++ b/manifests/moduledir/common.pp
@@ -0,0 +1,3 @@
+class common::moduledir::common{
+ module_dir{'common': }
+}
diff --git a/manifests/moduledir/common/cf.pp b/manifests/moduledir/common/cf.pp
new file mode 100644
index 0000000..b3c089b
--- /dev/null
+++ b/manifests/moduledir/common/cf.pp
@@ -0,0 +1,4 @@
+class common::moduledir::common::cf {
+ include ::common::moduledir::common
+ module_dir{'common/cf': }
+}