Puppet Class: ssh

Defined in:
manifests/init.pp

Overview

Class: ssh

Full description of class ssh here.

Parameters

sample_parameter

Explanation of what this parameter affects and what it defaults to.

Parameters:

  • package (Any) (defaults to: 'openssh')
  • tap (Any) (defaults to: undef)
  • keypath (Any) (defaults to: "/Users/${::user}/.ssh/id_ed25519")


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/init.pp', line 10

class ssh (
  $package = 'openssh',
  $tap = undef,
  $keypath = "/Users/${::user}/.ssh/id_ed25519"
) {

  if $tap {
    $package_fullname = "${tap}/${package}"
    $tap_require = Homebrew::Tap[$tap]
  } else {
    $package_fullname = $package
    $tap_require = []
  }

  package { $package_fullname:
    require => $tap_require
  } ->
  exec { 'remove stale SSH key':
    command => "rm -f ${keypath}.pub",
    unless  => ["test -e ${keypath}", 'ssh-add -l | grep ED25519']
  } ->
  ssh_key { $::luser:
    require => Package['gpg']
  } ->
  github_ssh_key { "${keypath}.pub": } ->
  exec { "ssh-add ${keypath}":
    unless   => 'ssh-add -l | grep ED25519',
    provider => 'shell',
    user     => $::user
  } ->
  file { $keypath:
    ensure => absent
  }
}