summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-06-25 13:36:53 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-06-25 13:36:53 -0300
commit1270e496bfd3b9f5ebd293c633c7606315fc203b (patch)
tree0aca3d6f4289a5ea5b275c92a14d4760cb9da9a4 /manifests
parent66f92221aa0cd683362af956e693aed12d30e4bd (diff)
downloadpuppet-certbot-1270e496bfd3b9f5ebd293c633c7606315fc203b.tar.gz
puppet-certbot-1270e496bfd3b9f5ebd293c633c7606315fc203b.tar.bz2
Support for additional domains
Diffstat (limited to 'manifests')
-rw-r--r--manifests/manage.pp11
1 files changed, 10 insertions, 1 deletions
diff --git a/manifests/manage.pp b/manifests/manage.pp
index ebcbbad..ce14b0f 100644
--- a/manifests/manage.pp
+++ b/manifests/manage.pp
@@ -1,9 +1,18 @@
define certbot::manage(
$pre_hook = '',
+ $aliases = "www.${name}",
$ensure = present,
$email = hiera('certbot::manage::email'),
$size = hiera('certbot::manage::size', '4096'),
){
+ # Format aliases and strip wildcard attempts
+ $list = regsubst($aliases, ' ', ' -d ', 'G')
+ $strip = regsubst($list, '\*', 'www', 'G')
+ $domains = $strip ? {
+ '' => '',
+ default => "-d ${strip}",
+ }
+
file { "${::certbot::basedir}/${name}":
ensure => directory,
owner => 'root',
@@ -18,7 +27,7 @@ define certbot::manage(
# Make sure nginx is restarted and request a certificate
exec { "certbot-${name}":
- command => "${real_pre_hook}/usr/bin/certbot certonly --webroot -w ${::certbot::basedir}/${name} -d ${name} -d www.${name} -m ${email} --rsa-key-size ${size} --agree-tos",
+ command => "${real_pre_hook}/usr/bin/certbot certonly --webroot -w ${::certbot::basedir}/${name} -d ${name} ${domains} -m ${email} --rsa-key-size ${size} --agree-tos",
creates => "/etc/letsencrypt/archive/${name}",
require => File["${::certbot::basedir}/${name}"],
}