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

fix cron conditional, common namespace fixes, domain template includes domain

This commit is contained in:
Bob Belnap 2018-02-27 10:32:51 -05:00
parent 8a09e270ce
commit b8431548a7
4 changed files with 25 additions and 20 deletions

View File

@ -2,6 +2,7 @@ class acme_vault::common (
$user = $::acme_vault::params::user, $user = $::acme_vault::params::user,
$group = $::acme_vault::params::group, $group = $::acme_vault::params::group,
$home_dir = $::acme_vault::params::home_dir, $home_dir = $::acme_vault::params::home_dir,
$domains = $::acme_vault::params::domains,
$contact_email = $::acme_vault::params::contact_email, $contact_email = $::acme_vault::params::contact_email,
$vault_token = $::acme_vault::params::vault_token, $vault_token = $::acme_vault::params::vault_token,

View File

@ -1,10 +1,10 @@
class acme_vault::deploy( class acme_vault::deploy(
$user = $::acme_vault::params::user, $user = $::acme_vault::common::user,
$group = $::acme_vault::params::group, $group = $::acme_vault::common::group,
$home_dir = $::acme_vault::params::home_dir, $home_dir = $::acme_vault::common::home_dir,
$domains = $::acme_vault::common::domains,
$cert_destination_path = $::acme_vault::params::cert_destination_path, $cert_destination_path = $::acme_vault::params::cert_destination_path,
$domains = $::acme_vault::params::domains,
$restart = $::acme_vault::params::restart, $restart = $::acme_vault::params::restart,
$restart_command = $::acme_vault::params::restart_command, $restart_command = $::acme_vault::params::restart_command,
@ -20,26 +20,29 @@ class acme_vault::deploy(
source => 'puppet:///modules/acme_vault/check_cert.sh', source => 'puppet:///modules/acme_vault/check_cert.sh',
} }
if $restart { # ensure destination path exists
$cron_command = "${home_dir}/check_cert.sh ${domain} ${cert_destination_path} && ${restart_command}" file {$cert_destination_path:
} else { ensure => directory,
$cron_command = "${home_dir}/check_cert.sh ${domain} ${cert_destination_path}" owner => $user,
group => $group,
mode => '0750',
} }
# cron job for deploy
if $restart {
$restart_suffix = "&& ${restart_command}"
} else {
$restart_suffix = ""
}
notice($user) $domains.each |$domain, $d_list| {
$domains.each |$domain| {
cron { "${domain}_deploy": cron { "${domain}_deploy":
command => $cron_command, command => "${home_dir}/check_cert.sh ${domain} ${cert_destination_path} ${restart_suffix}",
user => $user, user => $user,
weekday => 2, weekday => 2,
} }
} }
} }

View File

@ -1,9 +1,10 @@
class acme_vault::requestor ( class acme_vault::requestor (
$user = $::acme_vault::params::user, $user = $::acme_vault::common::user,
$group = $::acme_vault::params::group, $group = $::acme_vault::common::group,
$home_dir = $::acme_vault::params::home_dir, $home_dir = $::acme_vault::common::home_dir,
$contact_email = $::acme_vault::common::contact_email,
$domains = $::acme_vault::common::domains,
$contact_email = $::acme_vault::params::contact_email,
$staging = $::acme_vault::params::staging, $staging = $::acme_vault::params::staging,
$staging_url = $::acme_vault::params::staging_url, $staging_url = $::acme_vault::params::staging_url,
$prod_url = $::acme_vault::params::prod_url, $prod_url = $::acme_vault::params::prod_url,
@ -16,7 +17,6 @@ class acme_vault::requestor (
$lexicon_username = $::acme_vault::params::lexicon_username, $lexicon_username = $::acme_vault::params::lexicon_username,
$lexicon_token = $::acme_vault::params::lexicon_token, $lexicon_token = $::acme_vault::params::lexicon_token,
$domains = $::acme_vault::params::domains,
) inherits acme_vault::params { ) inherits acme_vault::params {

View File

@ -11,6 +11,7 @@
<% } -%> <% } -%>
--dns dns_lexicon \ --dns dns_lexicon \
--dnssleep 600 \ --dnssleep 600 \
--domain "<%= $domain %>" \
<% $domains.each |$d| { -%> <% $domains.each |$d| { -%>
--domain "<%= $d %>" \ --domain "<%= $d %>" \
<% } -%> <% } -%>