From fbb3cb7dcd8406f085e80f3f11fa873b55bd5073 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 May 2009 22:27:05 +0200 Subject: extracted every define and class in it's own file --- manifests/htpasswd_user.pp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 manifests/htpasswd_user.pp (limited to 'manifests/htpasswd_user.pp') 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}", + } +} -- cgit v1.2.3