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 ? {
$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,
# 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",