1
0
mirror of https://github.com/krislamo/puppet-acme_vault synced 2024-11-09 20:30:36 +00:00

Implement script-based restart method

This commit is contained in:
Kris Lamoureux 2020-08-11 11:14:38 -04:00
parent 012f5295fe
commit 55f5c3e377
Signed by: kris
GPG Key ID: A30022791E1719A4
2 changed files with 12 additions and 22 deletions

View File

@ -8,8 +8,8 @@ class acme_vault::deploy(
$domains = $::acme_vault::common::domains, $domains = $::acme_vault::common::domains,
$cert_destination_path = $::acme_vault::params::cert_destination_path, $cert_destination_path = $::acme_vault::params::cert_destination_path,
$restart = $::acme_vault::params::restart, $deploy_scripts = $::acme_vault::params::deploy_scripts,
$restart_command = $::acme_vault::params::restart_command, $restart_method = $::acme_vault::params::restart_method,
) inherits acme_vault::params { ) inherits acme_vault::params {
include acme_vault::common include acme_vault::common
@ -23,25 +23,18 @@ class acme_vault::deploy(
source => 'puppet:///modules/acme_vault/check_cert.sh', source => 'puppet:///modules/acme_vault/check_cert.sh',
} }
# ensure destination path exists # ensure destination paths exist
file {$cert_destination_path: file {[$cert_destination_path, $deploy_scripts]:
ensure => directory, ensure => directory,
owner => $user, owner => $user,
group => $group, group => $group,
mode => '0750', mode => '0750',
} }
# cron job for deploy
if $restart {
$restart_suffix = "&& ${restart_command}"
} else {
$restart_suffix = ''
}
# go through each domain, setup cron, and ensure the destination dir exists # go through each domain, setup cron, and ensure the destination dir exists
$domains.each |$domain, $d_list| { $domains.each |$domain, $d_list| {
cron { "${domain}_deploy": cron { "${domain}_deploy":
command => ". \$HOME/.bashrc && ${home_dir}/check_cert.sh ${domain} ${cert_destination_path} ${restart_suffix}", command => ". \$HOME/.bashrc && ${home_dir}/check_cert.sh ${domain} ${cert_destination_path} && ${restart_method}",
user => $user, user => $user,
weekday => 2, weekday => 2,
hour => 11, hour => 11,

View File

@ -32,10 +32,7 @@ class acme_vault::params {
$lexicon_token = undef $lexicon_token = undef
# settings for deploy # settings for deploy
$cert_destination_path = '/etc/acme'
$cert_destination_path = '/etc/acme/' $deploy_scripts = "${cert_destination_path}/deploy.d"
$restart_method = "for f in ${deploy_scripts}/*.sh; do \"\$f\"; done"
$restart = false
$restart_command = 'echo restart!'
} }