Public paste
Undefined
By: miah | Date: Mar 30 2010 19:32 | Format: None | Expires: never | Size: 1.25 KB | Hits: 500

  1. # ssh.pp
  2. # Miah Johnson - <miahNO$P4M@chia-pet.org>
  3. # Describes how to install SSH, and ensures it is running.
  4.  
  5. class ssh {
  6.  
  7.   case $operatingsystem {
  8.     solaris: { $ossl_lib = ["CSWossl"] }
  9.     opensuse: { $ossl_lib = ["libopenssl0_9_8"] }
  10.     default: { $ossl_lib = ["openssl"] }
  11.   }
  12.  
  13.   package { $ossl_lib:
  14.     ensure => "installed",
  15.     alias => "openssl",
  16.   }
  17.  
  18.   case $operatingsystem {
  19.     solaris: { $ssh_srv = ["CSWossh"] }
  20.     suse: { $ssh_srv = ["openssh"] }
  21.     opensuse: { $ssh_srv = ["openssh"] }
  22.     default: { $ssh_srv = ["openssh-server"] }
  23.   }
  24.  
  25.   package { $ssh_srv:
  26.     ensure => "installed",
  27.     require => Package[openssl],
  28.   }
  29.  
  30.   file { sshdconfig:
  31.    path => $operatingsystem ? {
  32.      solaris => "/opt/csw/etc/ssh/sshd_config",
  33.      default => "/etc/ssh/sshd_config",
  34.    },
  35.    owner => "root",
  36.    group => "root",
  37.    mode => "600",
  38.    checksum => "md5lite",
  39.    source => "puppet://puppet/nst/sshd_config",
  40.    ensure => "present",
  41.    require => Package["$ssh_srv"],
  42.   }
  43.  
  44.   service { sshd:
  45.     name => $operatingsystem ? {
  46.       centos => "sshd",
  47.       default => "sshd"
  48.     },
  49.     enable => "true",
  50.     ensure => "running",
  51.     subscribe => file[sshdconfig],
  52.     require => Package["$ssh_srv"],
  53.   }
  54.  
  55. }