only generate host_credential and mirror cronjob if dest_host is set

This commit is contained in:
Leif Johansson 2018-02-23 15:09:19 +01:00
parent e4d31f76a7
commit 322bf6b63f

View file

@ -129,7 +129,7 @@ class md_repo_client {
}
}
class md_signer($dest_host="localhost",$dest_dir="") {
class md_signer($dest_host=undef,$dest_dir="") {
sunet::snippets::secret_file {"/etc/credentials/metadata.key":
hiera_key => 'eidas_metadata_key',
base64 => true
@ -139,19 +139,21 @@ class md_signer($dest_host="localhost",$dest_dir="") {
pound_and_varnish => false,
pipeline => "${name}.fd",
volumes => ["/etc/credentials:/etc/credentials"]
} ->
sunet::ssh_host_credential { "${name}-publish-credential":
hostname => $dest_host,
username => 'root',
group => 'root',
manage_user => false,
ssh_privkey => safe_hiera("publisher_ssh_privkey")
} ->
sunet::scriptherder::cronjob { "${name}-publish":
cmd => "env RSYNC_ARGS='--chown=www-data:www-data --chmod=D0755,F0664' /usr/local/bin/mirror-mdq.sh http://localhost root@${dest_host}:${dest_dir}",
minute => '*/5',
ok_criteria => ['exit_status=0'],
warn_criteria => ['max_age=30m']
}
if ($dest_host) {
sunet::ssh_host_credential { "${name}-publish-credential":
hostname => $dest_host,
username => 'root',
group => 'root',
manage_user => false,
ssh_privkey => safe_hiera("publisher_ssh_privkey")
} ->
sunet::scriptherder::cronjob { "${name}-publish":
cmd => "env RSYNC_ARGS='--chown=www-data:www-data --chmod=D0755,F0664' /usr/local/bin/mirror-mdq.sh http://localhost root@${dest_host}:${dest_dir}",
minute => '*/5',
ok_criteria => ['exit_status=0'],
warn_criteria => ['max_age=30m']
}
}
}