diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-30 21:01:49 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-30 21:01:49 -0300 |
commit | 42381cde353aaa3fd6ae60e5adec9aa6a906c069 (patch) | |
tree | 3dfb6b8732c0c953925c0174fdaa6f7d1a554478 | |
parent | 577c88822a01de27e208a824ba66a93ac9fb75c7 (diff) | |
download | puppet-certbot-42381cde353aaa3fd6ae60e5adec9aa6a906c069.tar.gz puppet-certbot-42381cde353aaa3fd6ae60e5adec9aa6a906c069.tar.bz2 |
Support for pre and post commands at certbot class
-rw-r--r-- | manifests/init.pp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 96e16b1..483511f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,10 +1,12 @@ class certbot( - $script_base = '/usr/bin', - $basedir = '/var/spool/certbot', - $owner = 'www-data', - $pre_hook = '', - $post_hook = '', - $plugin = 'webroot', + $script_base = '/usr/bin', + $basedir = '/var/spool/certbot', + $owner = 'www-data', + $pre_hook = '', + $post_hook = '', + $pre_command = '', + $post_command = '', + $plugin = 'webroot', ) { $tool = $::lsbdistcodename ? { @@ -20,6 +22,14 @@ class certbot( $real_post_hook = "--post-hook \"${post_hook}\"" } + if $pre_command != '' { + $real_pre_command = "${pre_command} &&" + } + + if $post_command != '' { + $real_post_command = "&& ${post_command}" + } + # Certbot support file { $basedir: ensure => directory, @@ -38,7 +48,7 @@ class certbot( # Chosing an arbitrary minute within the hour in the hope that won't overload Let's Encrypt servers cron { 'certbot-renew': - command => "${script_base}/${tool} renew --${plugin} --quiet -n ${real_pre_hook} ${real_post_hook}", + command => "${real_pre_command}${script_base}/${tool} renew --${plugin} --quiet -n ${real_pre_hook} ${real_post_hook}${real_post_command}", user => 'root', hour => [ 5, 23 ], minute => "28", |