From 322bf6b63f4d370c7ca2d1fca1dfe5bd3f20d308 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Fri, 23 Feb 2018 15:09:19 +0100 Subject: [PATCH] only generate host_credential and mirror cronjob if dest_host is set --- .../etc/puppet/manifests/cosmos-site.pp | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/global/overlay/etc/puppet/manifests/cosmos-site.pp b/global/overlay/etc/puppet/manifests/cosmos-site.pp index 6db7cb31..2e236f05 100644 --- a/global/overlay/etc/puppet/manifests/cosmos-site.pp +++ b/global/overlay/etc/puppet/manifests/cosmos-site.pp @@ -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'] + } } }