Merge pull request #367 from Puppet-Finland/conditional_export

Allow not exporting SSH keys
This commit is contained in:
Garrett Honeycutt 2021-12-27 11:56:28 -05:00 committed by GitHub
commit 7b678c56a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View File

@ -808,9 +808,19 @@ Export node SSH key. Valid values are 'present' and 'absent'.
- *Default*: 'present' - *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 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' - *Default*: 'true'

View File

@ -102,6 +102,7 @@ class ssh (
$service_hasrestart = true, $service_hasrestart = true,
$service_hasstatus = 'USE_DEFAULTS', $service_hasstatus = 'USE_DEFAULTS',
$ssh_key_ensure = 'present', $ssh_key_ensure = 'present',
$ssh_key_export = true,
$ssh_key_import = true, $ssh_key_import = true,
$ssh_key_type = 'ssh-rsa', $ssh_key_type = 'ssh-rsa',
$ssh_config_global_known_hosts_file = '/etc/ssh/ssh_known_hosts', $ssh_config_global_known_hosts_file = '/etc/ssh/ssh_known_hosts',
@ -1200,12 +1201,14 @@ class ssh (
else { $host_aliases = [$::hostname, $::ipaddress] } else { $host_aliases = [$::hostname, $::ipaddress] }
# export each node's ssh key # export each node's ssh key
if $ssh_key_export {
@@sshkey { $::fqdn : @@sshkey { $::fqdn :
ensure => $ssh_key_ensure, ensure => $ssh_key_ensure,
host_aliases => $host_aliases, host_aliases => $host_aliases,
type => $ssh_key_type, type => $ssh_key_type,
key => $key, key => $key,
} }
}
file { 'ssh_known_hosts': file { 'ssh_known_hosts':
ensure => file, ensure => file,