From fbd4a76f453ddae61330864c4aad429d77f04d03 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 5 Feb 2018 11:00:49 -0200 Subject: Fix ssl/certbot absence behavior --- manifests/site.pp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/manifests/site.pp b/manifests/site.pp index 9997e97..983fc88 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -20,7 +20,10 @@ define nginx::site( aliases => $aliases, } - if $certbot == true { + # We should discover the best practices' way to + # stop managing a certificate using certbot so + # we can implement an ensurable properly. + if $certbot == true and $ensure == 'present' { certbot::manage { $name: aliases => $aliases, pre_hook => '/usr/sbin/service nginx restart', @@ -30,13 +33,19 @@ define nginx::site( nginx::site::config { "${name}-ssl": server_name => $name, - ensure => $ssl, + ensure => $ensure ? { + 'present' => $ssl, + default => absent, + }, source => $source, template => "${template}-ssl", backend => $backend, aliases => $aliases, require => $certbot ? { - true => Certbot::Manage[$name], + true => $ensure ? { + 'present' => Certbot::Manage[$name], + default => undef, + }, default => undef, } } -- cgit v1.2.3