summaryrefslogtreecommitdiff
path: root/manifests/vhost/file.pp
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2009-05-17 22:27:05 +0200
committermh <mh@immerda.ch>2009-05-17 22:27:05 +0200
commitfbb3cb7dcd8406f085e80f3f11fa873b55bd5073 (patch)
treea95d59498674420347e7c115569cc42407d85d82 /manifests/vhost/file.pp
parentc4b3c53375ab001c5cb6407537d64ff3b2ec35cf (diff)
extracted every define and class in it's own file
Diffstat (limited to 'manifests/vhost/file.pp')
-rw-r--r--manifests/vhost/file.pp85
1 files changed, 85 insertions, 0 deletions
diff --git a/manifests/vhost/file.pp b/manifests/vhost/file.pp
new file mode 100644
index 0000000..c31420e
--- /dev/null
+++ b/manifests/vhost/file.pp
@@ -0,0 +1,85 @@
+# htpasswd_file: wether to deploy a passwd for this vhost or not
+# - absent: ignore (default)
+# - nodeploy: htpasswd file isn't deployed by this mechanism
+# - else: try to deploy the file
+#
+# htpasswd_path: where to deploy the passwd file
+# - absent: standardpath (default)
+# - else: path to deploy
+#
+define apache::vhost::file(
+ $ensure = present,
+ $vhost_source = 'absent',
+ $vhost_destination = 'absent',
+ $content = 'absent',
+ $do_includes = false,
+ $htpasswd_file = 'absent',
+ $htpasswd_path = 'absent'
+){
+ $vhosts_dir = $operatingsystem ? {
+ centos => "$apache::centos::config_dir/vhosts.d/",
+ gentoo => "$apache::gentoo::config_dir/vhosts.d/",
+ debian => "$apache::debian::config_dir/vhosts.d/",
+ ubuntu => "$apache::ubuntu::config_dir/vhosts.d/",
+ openbsd => "$apache::openbsd::config_dir/vhosts.d/",
+ default => '/etc/apache2/vhosts.d/',
+ }
+ $real_vhost_destination = $vhost_destination ? {
+ 'absent' => "$vhosts_dir/$name.conf",
+ default => $vhost_destination,
+ }
+ file{"${name}.conf":
+ ensure => $ensure,
+ path => $real_vhost_destination,
+ require => File[vhosts_dir],
+ notify => Service[apache],
+ owner => root, group => 0, mode => 0644;
+ }
+ if $do_includes {
+ include apache::includes
+ }
+ case $content {
+ 'absent': {
+ $real_vhost_source = $vhost_source ? {
+ 'absent' => [
+ "puppet://$server/files/apache/vhosts.d/$fqdn/$name.conf",
+ "puppet://$server/files/apache/vhosts.d/$apache_cluster_node/$name.conf",
+ "puppet://$server/files/apache/vhosts.d/$operatingsystem.$lsbdistcodename/$name.conf",
+ "puppet://$server/files/apache/vhosts.d/$operatingsystem/$name.conf",
+ "puppet://$server/files/apache/vhosts.d/$name.conf",
+ "puppet://$server/apache/vhosts.d/$name.conf",
+ "puppet://$server/apache/vhosts.d/$operatingsystem.$lsbdistcodename/$name.conf",
+ "puppet://$server/apache/vhosts.d/$operatingsystem/$name.conf",
+ "puppet://$server/apache/vhosts.d/$name.conf"
+ ],
+ default => "puppet://$server/$vhost_source",
+ }
+ File["${name}.conf"]{
+ source => $real_vhost_source,
+ }
+ }
+ default: {
+ File["${name}.conf"]{
+ content => $content,
+ }
+ }
+ }
+ case $htpasswd_file {
+ 'absent','nodeploy': { info("don't deploy a htpasswd file for ${name") }
+ default: {
+ if $htpasswd_path == 'absent' {
+ $real_htpasswd_path = "/var/www/htpasswds/$name"
+ } else {
+ $real_htpasswd_path = $htpasswd_path
+ }
+ file{$real_htpasswd_path:
+ ensure => $ensure,
+ source => [ "puppet://$server/files/apache/htpasswds/$fqdn/$name",
+ "puppet://$server/files/apache/htpasswds/$apache_cluster_node/$name",
+ "puppet://$server/files/apache/htpasswds/$name" ],
+ owner => root, group => 0, mode => 0644;
+ }
+ }
+ }
+}
+