Puppet Class: ssh::client

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:

  • ssh_config (Stdlib::Absolutepath)

    Path to ssh client config file

  • client_package_name (Optional[String[1]]) (defaults to: undef)

    Name of the client package

  • 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: {})

    SSH client options, will be deep_merged with default_options. This parameter takes precedence over default_options

  • use_augeas (Boolean) (defaults to: false)

    Use augeas to configure ssh client

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

    Remove options (with augeas style)

  • default_options (Hash)

    Default options to set, will be merged with options parameter

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

    Add ssh match_block (with concat)



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'manifests/client.pp', line 38

class ssh::client (
  Stdlib::Absolutepath $ssh_config,
  Hash                 $default_options,
  Optional[String[1]]  $client_package_name  = undef,
  String               $ensure               = present,
  Boolean              $storeconfigs_enabled = true,
  Hash                 $options              = {},
  Boolean              $use_augeas           = false,
  Array                $options_absent       = [],
  Hash                 $match_block          = {},
) {
  if $use_augeas {
    $merged_options = sshclient_options_to_augeas_ssh_config($options, $options_absent, { 'target' => $ssh_config })
  } else {
    $merged_options = deep_merge($options, delete($default_options, keys($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']
  }

  $match_block.each |String $k, Hash $v| {
    ssh::client::match_block { $k:
      * => $v,
    }
  }
}