diff options
author | mh <mh@d66ca3ae-40d7-4aa7-90d4-87d79ca94279> | 2008-04-04 15:30:26 +0000 |
---|---|---|
committer | mh <mh@d66ca3ae-40d7-4aa7-90d4-87d79ca94279> | 2008-04-04 15:30:26 +0000 |
commit | 0603077ce67fe83a89bab0bfc7605f8d99dbc7ec (patch) | |
tree | 48753bdad291cd64aea245a3ad1e1a2466007f94 /manifests/init.pp | |
parent | eba8003eefaa797b420687208e523190352136de (diff) |
moved /dist/-stuff to /files/, heavily refactored a lot, made it more look all the same way. some sources added here and there. hope it still works everything, the location on the disk of /files/ is still call dists. no need to hurry to change that
git-svn-id: https://svn/ipuppet/trunk/modules/sshd@1160 d66ca3ae-40d7-4aa7-90d4-87d79ca94279
Diffstat (limited to 'manifests/init.pp')
-rw-r--r-- | manifests/init.pp | 117 |
1 files changed, 77 insertions, 40 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 14407d4..48363f1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,51 +5,27 @@ #modules_dir { "sshd": } class sshd { + case $operatingsystem { + gentoo: { include sshd::gentoo } + redhat: { include sshd::redhat } + centos: { include sshd::centos } + openbsd: { include sshd::openbsd } + default: { include sshd::default } + } +} + - case $operatingsystem { - OpenBSD: { - exec{sshd_refresh: - command => "/bin/kill -HUP `/bin/cat /var/run/sshd.pid`", - refreshonly => true, - } - } - default: { - service{'sshd': - name => $operatingsystem ? { - debian => 'ssh', - ubuntu => 'ssh', - default => 'sshd', - }, - enable => true, - ensure => running, - require => Package[openssh], - } - package{openssh: - name => $operatingsystem ? { - debian => 'openssh-server', - ubuntu => 'openssh-server', - redhat => 'openssh-server', - centos => 'openssh-server', - default => 'openssh', - }, - category => $operatingsystem ? { - gentoo => 'net-misc', - default => '', - }, - ensure => present, - } } } +class sshd::base { $real_sshd_config_source = $sshd_config_source ? { '' => "sshd/sshd_config/${operatingsystem}_normal.erb", default => $source, } - #notice("sshd_allowed_users is set to ${sshd_allowed_users}") - $real_sshd_allowed_users = $sshd_allowed_users ? { '' => 'root', default => $sshd_allowed_users, @@ -61,13 +37,74 @@ class sshd { group => 0, mode => 600, content => template("${real_sshd_config_source}"), - notify => $operatingsystem ? { - openbsd => Exec[sshd_refresh], - default => Service[sshd], - }, } } +class sshd::linux inherits sshd::base { + package{openssh: + ensure => present, + } + include sshd::service + File[sshd_config]{ + notify => Service[sshd], + } +} + +class sshd::gentoo inherits sshd::linux { + Package[openssh]{ + category => 'net-misc', + } +} + +class sshd::debian inherits sshd::linux { + Package[openssh]{ + name => 'openssh-server', + } +} +class sshd::ubuntu inherits sshd::debian {} + +class sshd::redhat inherits sshd::linux { + Package[openssh]{ + name => 'openssh-server', + } +} +class sshd::centos inherits sshd::redhat {} + +class sshd::openbsd inherits sshd::base { + exec{sshd_refresh: + command => "/bin/kill -HUP `/bin/cat /var/run/sshd.pid`", + refreshonly => true, + } + File[sshd_config]{ + notify => Exec[sshd_refresh], + } +} + +### service stuff +class sshd::service { + case $operatingsystem { + debian: { include sshd::service::debian } + ubuntu: { include sshd::service::ubuntu } + default: { include sshd::service::base } + } + +class sshd::service::base { + service{'sshd': + name => 'sshd', + enable => true, + ensure => running, + require => Package[openssh], + } +} + +class sshd::service::debian inherits sshd::service::base { + Service[sshd]{ + name => 'ssh', + } +} +class sshd::service::ubuntu inherits sshd::service::debian {} + +### defines define sshd::deploy_auth_key( $source = '', $user = 'root', @@ -85,8 +122,8 @@ define sshd::deploy_auth_key( } $real_source = $source ? { - '' => [ "puppet://$server/sshd/authorized_keys/${name}", - "puppet://$server/dist/sshd/authorized_keys/${name}"], + '' => [ "puppet://$server/files/sshd/authorized_keys/${name}", + "puppet://$server/sshd/authorized_keys/${name}" ] default => "puppet://$server/$source", } |