Puppet Class: puppet::server::bootstrap::globals

Inherits:
puppet::globals
Defined in:
manifests/server/bootstrap/globals.pp

Summary

A short summary of the purpose of this class

Overview

A description of what this class does

Examples:

include puppet::server::bootstrap::globals

Parameters:

  • access_data (Array[ Struct[{ name => Stdlib::Fqdn, key_data => String, key_prefix => String, Optional[server] => Stdlib::Fqdn, Optional[sshkey_type] => Openssh::KeyID, Optional[ssh_options] => Openssh::SshConfig, }] ]) (defaults to: [])
  • ssh_config (Array[Openssh::SshConfig]) (defaults to: [])


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'manifests/server/bootstrap/globals.pp', line 7

class puppet::server::bootstrap::globals (
  Array[
    Struct[{
        name                  => Stdlib::Fqdn,
        key_data              => String,
        key_prefix            => String,
        Optional[server]      => Stdlib::Fqdn,
        Optional[sshkey_type] => Openssh::KeyID,
        Optional[ssh_options] => Openssh::SshConfig,
    }]
  ] $access_data = [],
  Array[Openssh::SshConfig] $ssh_config = [],
) inherits puppet::globals {
  $ssh_access_config = $access_data.reduce([]) |$memo, $creds| {
    $key_name    = $creds['name']

    $server      = $creds['server'] ? {
      String  => $creds['server'],
      default => downcase($key_name)
    }

    $key_prefix  = $creds['key_prefix']

    $sshkey_type = $creds['sshkey_type'] ? {
      String  => $creds['sshkey_type'],
      default => 'ed25519'
    }

    $config      = {
      'Host'                  => $server,
      'StrictHostKeyChecking' => 'no',
      'IdentityFile'          => "~/.ssh/${key_prefix}.id_${sshkey_type}",
    } + $creds['ssh_options']

    $memo + [$config]
  }
}