From 92de7107508278bbdc1c603fc2a37772a1ebe5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sepp=C3=A4nen?= Date: Mon, 27 Dec 2021 16:48:28 +0200 Subject: [PATCH] Allow not exporting SSH keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables silencing some useless warnings when using Puppet Bolt for example Signed-off-by: Samuli Seppänen --- README.md | 12 +++++++++++- manifests/init.pp | 13 ++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1672d1f..52ce076 100644 --- a/README.md +++ b/README.md @@ -808,9 +808,19 @@ Export node SSH key. Valid values are 'present' and 'absent'. - *Default*: 'present' +ssh_key_export +-------------- + +Export this hosts' SSH key. If you don't use storeconfigs turn this to false to +silence some useless warnings. + +- *Default*: true + ssh_key_import -------------- -Import all exported node SSH keys. Valid values are 'true' and 'false'. + +Import all exported node SSH keys. Valid values are 'true' and 'false'. If you +don't use storeconfigs set this to 'false' to silence some useless warnings. - *Default*: 'true' diff --git a/manifests/init.pp b/manifests/init.pp index 113a6f1..2af38a5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -102,6 +102,7 @@ class ssh ( $service_hasrestart = true, $service_hasstatus = 'USE_DEFAULTS', $ssh_key_ensure = 'present', + $ssh_key_export = true, $ssh_key_import = true, $ssh_key_type = 'ssh-rsa', $ssh_config_global_known_hosts_file = '/etc/ssh/ssh_known_hosts', @@ -1200,11 +1201,13 @@ class ssh ( else { $host_aliases = [$::hostname, $::ipaddress] } # export each node's ssh key - @@sshkey { $::fqdn : - ensure => $ssh_key_ensure, - host_aliases => $host_aliases, - type => $ssh_key_type, - key => $key, + if $ssh_key_export { + @@sshkey { $::fqdn : + ensure => $ssh_key_ensure, + host_aliases => $host_aliases, + type => $ssh_key_type, + key => $key, + } } file { 'ssh_known_hosts':