Puppet Class: ssh::client

Inherits:
ssh::params
Defined in:
manifests/client.pp

Summary

This class add ssh client management

Overview

Examples:

Puppet usage

class { 'ssh::client':
  ensure               => present,
  storeconfigs_enabled => true,
  use_augeas           => false,
}

Parameters:

  • ensure (String) (defaults to: present)

    Ensurable param to ssh client

  • storeconfigs_enabled (Boolean) (defaults to: true)

    Collected host keys from servers will be written to known_hosts unless storeconfigs_enabled is false

  • options (Hash) (defaults to: {})

    Dynamic hash for openssh client options

  • options_absent (Array) (defaults to: [])

    Remove options (with augeas style)

  • use_augeas (Boolean) (defaults to: false)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'manifests/client.pp', line 23

class ssh::client (
  String  $ensure               = present,
  Boolean $storeconfigs_enabled = true,
  Hash    $options              = {},
  Boolean $use_augeas           = false,
  Array   $options_absent       = [],
) inherits ssh::params {
  # Merge hashes from multiple layer of hierarchy in hiera
  $hiera_options = lookup("${module_name}::client::options", Optional[Hash], 'deep', {})

  $fin_options = deep_merge($hiera_options, $options)

  if $use_augeas {
    $merged_options = sshclient_options_to_augeas_ssh_config($fin_options, $options_absent, { 'target' => $ssh::params::ssh_config })
  } else {
    $merged_options = merge($fin_options, delete($ssh::params::ssh_default_options, keys($fin_options)))
  }

  include ssh::client::install
  include ssh::client::config

  # Provide option to *not* use storeconfigs/puppetdb, which means not managing
  #  hostkeys and knownhosts
  if ($storeconfigs_enabled) {
    include ssh::knownhosts

    Class['ssh::client::install']
    -> Class['ssh::client::config']
    -> Class['ssh::knownhosts']
  } else {
    Class['ssh::client::install']
    -> Class['ssh::client::config']
  }
}