summaryrefslogtreecommitdiff
path: root/manifests/htpasswd_user.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/htpasswd_user.pp
parentc4b3c53375ab001c5cb6407537d64ff3b2ec35cf (diff)
extracted every define and class in it's own file
Diffstat (limited to 'manifests/htpasswd_user.pp')
-rw-r--r--manifests/htpasswd_user.pp34
1 files changed, 34 insertions, 0 deletions
diff --git a/manifests/htpasswd_user.pp b/manifests/htpasswd_user.pp
new file mode 100644
index 0000000..5a7c413
--- /dev/null
+++ b/manifests/htpasswd_user.pp
@@ -0,0 +1,34 @@
+# ToDo: This should be rewritten as native type
+define apache::htpasswd_user(
+ $ensure = present,
+ $site = 'absent',
+ $username = 'absent',
+ $password,
+ $password_iscrypted = false,
+ $ensure = 'present',
+ $path = 'absent'
+){
+ case $username {
+ 'absent': { $real_username = $name }
+ default: { $real_username = $username }
+ }
+ case $site {
+ 'absent': { $real_site = $name }
+ default: { $real_site = $site }
+ }
+ case $path {
+ 'absent': { $real_path = "/var/www/htpasswds/${real_site}" }
+ default: { $real_path = $path }
+ }
+ if $password_iscrypted {
+ $real_password = $password
+ } else {
+ $real_password = htpasswd_sha1($password)
+ }
+
+ line{"htpasswd_for_${real_site}":
+ ensure => $ensure,
+ file => $real_path,
+ line => "${username}:${real_password}",
+ }
+}