summaryrefslogtreecommitdiff
path: root/manifests/defines/htpasswd.pp
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2008-12-05 14:42:12 +0000
committermh <mh@immerda.ch>2008-12-05 14:42:12 +0000
commitb690f927b3cb8d24c0ef514a989e47ee112eb0b9 (patch)
tree0d1bbfd2dca8b570a0c8fb4cf4b816a9626c725b /manifests/defines/htpasswd.pp
parent05465fa92dcd47a09c86d9bf2f47deb13543f4be (diff)
merged with puzzle
Diffstat (limited to 'manifests/defines/htpasswd.pp')
-rw-r--r--manifests/defines/htpasswd.pp33
1 files changed, 33 insertions, 0 deletions
diff --git a/manifests/defines/htpasswd.pp b/manifests/defines/htpasswd.pp
new file mode 100644
index 0000000..a24aa20
--- /dev/null
+++ b/manifests/defines/htpasswd.pp
@@ -0,0 +1,33 @@
+# manifests/defines/htpasswd.pp
+
+# ToDo: This should be rewritten as native type
+define apache::htpasswd_user(
+ $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 }
+ }
+ case $password_iscrypted {
+ 'false': { $real_password = htpasswd_sha1($password) }
+ default: { $real_password = $password }
+ }
+
+ line{"htpasswd_for_${real_site}":
+ file => $real_path,
+ line => "${username}:${real_password}",
+ }
+}