summaryrefslogtreecommitdiff
path: root/manifests/module.pp
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-18 18:23:51 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-18 18:23:51 -0200
commit35690aec253a16ca0c48f4fb249ce940dc5f48e0 (patch)
tree31e7b7ecb45e2dbc11f518ab0f1fbfe894895e1f /manifests/module.pp
parent0785451f5599f0c6dad60908a5773742f3188f05 (diff)
downloadpuppet-apache-35690aec253a16ca0c48f4fb249ce940dc5f48e0.tar.gz
puppet-apache-35690aec253a16ca0c48f4fb249ce940dc5f48e0.tar.bz2
Moving site and module definitions to different files
Diffstat (limited to 'manifests/module.pp')
-rw-r--r--manifests/module.pp25
1 files changed, 25 insertions, 0 deletions
diff --git a/manifests/module.pp b/manifests/module.pp
new file mode 100644
index 0000000..8a36432
--- /dev/null
+++ b/manifests/module.pp
@@ -0,0 +1,25 @@
+# Define an apache2 module. Debian packages place the module config
+# into /etc/apache2/mods-available.
+#
+# You can add a custom require (string) if the module depends on
+# packages that aren't part of the default apache2 package. Because of
+# the package dependencies, apache2 will automagically be included.
+define apache::module($ensure = 'present') {
+ case $ensure {
+ 'present': {
+ exec { "/usr/sbin/a2enmod $name":
+ unless => "/bin/sh -c '[ -L ${apache2_mods}-enabled/${name}.load ] \
+ && [ ${apache2_mods}-enabled/${name}.load -ef ${apache2_mods}-available/${name}.load ]'",
+ notify => Exec["force-reload-apache2"],
+ }
+ }
+ 'absent': {
+ exec { "/usr/sbin/a2dismod $name":
+ onlyif => "/bin/sh -c '[ -L ${apache2_mods}-enabled/${name}.load ] \
+ && [ ${apache2_mods}-enabled/${name}.load -ef ${apache2_mods}-available/${name}.load ]'",
+ notify => Exec["force-reload-apache2"],
+ }
+ }
+ default: { err ("Unknown ensure value: '$ensure'") }
+ }
+}