]> gitweb.fluxo.info Git - puppet-nginx.git/commitdiff
More certbot enhancements
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 16 Jun 2016 22:40:11 +0000 (19:40 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 16 Jun 2016 22:40:11 +0000 (19:40 -0300)
manifests/certbot.pp
manifests/init.pp
manifests/site.pp

index da2c67b46994d4ed512598c238243155b8d2391f..98f5203dffb7844bf3860edb656eb0e3e97854d3 100644 (file)
@@ -13,9 +13,10 @@ define nginx::certbot(
     require => Package['certbot'],
   }
 
+  # Make sure nginx is restarted and request a certificate
   exec { "certbot-${name}":
-    command => "/usr/bin/certbot certonly --webroot -w /var/www/certbot/${name} -d ${name} -d www.${name} -m ${email} --rsa-key-size ${size} --agree-tos",
+    command => "/usr/sbin/service nginx restart && /usr/bin/certbot certonly --webroot -w /var/www/certbot/${name} -d ${name} -d www.${name} -m ${email} --rsa-key-size ${size} --agree-tos",
     creates => "/etc/letsencrypt/archive/${name}",
-    require => File["/var/www/certbot/${name}"],
+    require => File["/var/www/certbot/${name}", "/etc/nginx/sites-enabled/$name"],
   }
 }
index c83bad3fcd8da932b5b8005ce2718aaec3186e0e..110a368e659620fb835abd96f3538d2b1049404e 100644 (file)
@@ -21,8 +21,9 @@ class nginx inherits nginx::base {
 
   # Default site
   nginx::site { "default":
-    ensure => present,
-    source => 'template',
+    ensure  => present,
+    source  => 'template',
+    certbot => false,
   }
 
   # Domain site
index ec8ba69313c6f13babf31dbe0557337f4dfb4b72..c2a0a89eba2d47e05021c4f7ddf9b632723bcdd2 100644 (file)
@@ -53,7 +53,6 @@ define nginx::site(
   if $certbot == true {
     nginx::certbot { $name:
       ensure  => $ensure,
-      require => File["/etc/nginx/sites-enabled/$name"],
     }
   }
 }