]> gitweb.fluxo.info Git - puppet-certbot.git/commitdiff
Support for additional domains
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 25 Jun 2016 16:36:53 +0000 (13:36 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 25 Jun 2016 16:36:53 +0000 (13:36 -0300)
manifests/manage.pp

index ebcbbad8347e6f496e754ba01ddfff887be8192f..ce14b0f32979a9d210e5669c6c4c6b9f2aff0054 100644 (file)
@@ -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}"],
   }