Puppet Class: ssh::known_hosts

Defined in:
manifests/known_hosts.pp

Overview

Class: ssh::known_hosts

Manges a global known_hosts file

Parameters:

  • manage (Any)
  • manage_hostkey (Any)
  • hostaliases (Any) (defaults to: undef)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'manifests/known_hosts.pp', line 4

class ssh::known_hosts (
    $manage,
    $manage_hostkey,
    $hostaliases = undef,
    ) {
    if $manage {
      if $manage_hostkey {
          $known_hosts = ssh_keygen(
              { 'request' => 'known_hosts', 'dir' => 'ssh/hostkeys' }
          )
          # if we are managing hostkeys, we are using its known_hosts file
          file { '/etc/ssh/ssh_known_hosts':
              mode    => '0644',
              content => $known_hosts
          }
      } else {
          # storeconfig based implementation is in another class, because
          # otherwise the server is complaining loud if storeconfig is not enabled
          class { 'ssh::known_hosts::storeconfig':
            hostaliases => $hostaliases,
          }
      }
    }
}