From b841d178ff55c28310cd466da6bd058c2e582c5c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 16 Jun 2016 19:40:11 -0300 Subject: More certbot enhancements --- manifests/certbot.pp | 5 +++-- manifests/init.pp | 5 +++-- manifests/site.pp | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/manifests/certbot.pp b/manifests/certbot.pp index da2c67b..98f5203 100644 --- a/manifests/certbot.pp +++ b/manifests/certbot.pp @@ -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"], } } diff --git a/manifests/init.pp b/manifests/init.pp index c83bad3..110a368 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 diff --git a/manifests/site.pp b/manifests/site.pp index ec8ba69..c2a0a89 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -53,7 +53,6 @@ define nginx::site( if $certbot == true { nginx::certbot { $name: ensure => $ensure, - require => File["/etc/nginx/sites-enabled/$name"], } } } -- cgit v1.2.3