module-sshd/manifests/base.pp

52 lines
1.3 KiB
ObjectPascal
Raw Normal View History

2014-02-14 01:24:15 +01:00
class sshd::base(
$ipaddres_fact = $sshd::ipaddres_fact,
) {
2013-02-03 00:30:54 +01:00
$sshd_config_content = $::lsbdistcodename ? {
'' => template("sshd/sshd_config/${::operatingsystem}.erb"),
default => template ("sshd/sshd_config/${::operatingsystem}_${::lsbdistcodename}.erb"),
}
file { 'sshd_config':
2014-01-26 11:19:11 +01:00
ensure => present,
2013-02-03 00:30:54 +01:00
path => '/etc/ssh/sshd_config',
content => $sshd_config_content,
notify => Service[sshd],
owner => root,
group => 0,
mode => '0600';
}
# Now add the key, if we've got one
2012-06-05 23:23:03 +02:00
case $::sshrsakey {
'': { info("no sshrsakey on ${::fqdn}") }
default: {
2012-06-05 23:23:03 +02:00
@@sshkey{$::fqdn:
2013-02-03 00:30:54 +01:00
ensure => present,
tag => 'fqdn',
2009-12-27 17:23:51 +01:00
type => ssh-rsa,
2012-06-05 23:23:03 +02:00
key => $::sshrsakey,
}
# In case the node has uses a shared network address,
2009-12-27 17:23:51 +01:00
# we don't define a sshkey resource using an IP address
2014-02-14 01:44:54 +01:00
$ipaddr = inline_template("<%= scope.lookupvar(ipaddres_fact) %>")
2013-02-03 00:30:54 +01:00
if $sshd::shared_ip == 'no' {
2014-02-14 01:24:15 +01:00
@@sshkey{$ipaddr:
2013-02-03 00:30:54 +01:00
ensure => present,
tag => 'ipaddress',
2009-12-27 17:23:51 +01:00
type => ssh-rsa,
2012-06-05 23:23:03 +02:00
key => $::sshrsakey,
2009-12-27 17:23:51 +01:00
}
}
2009-09-29 19:53:04 +02:00
}
}
service{'sshd':
2013-02-03 00:30:54 +01:00
ensure => running,
name => 'sshd',
enable => true,
hasstatus => true,
2013-02-03 00:30:54 +01:00
require => File[sshd_config],
}
2009-09-29 19:53:04 +02:00
}