summaryrefslogtreecommitdiff
path: root/manifests/htpasswd_user.pp
diff options
context:
space:
mode:
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}",
+ }
+}