summaryrefslogtreecommitdiffstats
path: root/modules/sshd/manifests/init.pp
blob: 690034bfe408302b05c8dfcfce386b96a07ef0c9 (plain) (blame)
1
2
3
4
5
6
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
class sshd {
  package { 'openssh':
    ensure => installed;
  }

  service { 'sshd':
    ensure => running,
    enable => true;
  }

  file {
    '/etc/ssh/sshd_config.d':
      ensure => directory,
      recurse => true,
      purge => true,
      require => Package['openssh'];
  }

  sshd::configsection { '00base':
    source => 'puppet:///modules/sshd/00base';
  }

  exec { 'assemble sshd_config':
    provider => 'shell',
    command => 'cd /etc/ssh/sshd_config.d && cat $(ls) > /etc/ssh/sshd_config',
    refreshonly => true;
  }

  File['/etc/ssh/sshd_config.d'] -> Sshd::Configsection<| |>
  Sshd::Configsection<| |> ~> Exec['assemble sshd_config']
  Exec['assemble sshd_config'] ~> Service['sshd']
}