From b690f927b3cb8d24c0ef514a989e47ee112eb0b9 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 5 Dec 2008 14:42:12 +0000 Subject: merged with puzzle --- manifests/defines/htpasswd.pp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 manifests/defines/htpasswd.pp (limited to 'manifests/defines/htpasswd.pp') 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}", + } +} -- cgit v1.2.3