dperusich

Untitled

Dec 5th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.36 KB | None | 0 0
  1. #
  2. class ssh {
  3.      # libdir changes base on arch
  4.      if $architecture == "x86_64" { $lib_dir = "lib64" }
  5.      else { $lib_dir = "lib" }
  6.  
  7.      # different package based on distro
  8.      package { "ssh":
  9.           name => $operatingsystem ? {
  10.                OpenSuSE => "openssh",
  11.                RedHat => [ "openssh", "openssh-clients", "openssh-server" ]
  12.           },
  13.           ensure => installed
  14.      }
  15.      #
  16.      define sshd_config (
  17.         $allowgroups = "",
  18.         $allowusers  = "",
  19.         $subsystem   = $operatingsystem ? {
  20.                      OpenSuSE => "Subsystem     sftp    /usr/$lib_dir/ssh/sftp-server -l INFO",
  21.                      RedHat => "Subsystem       sftp    /usr/libexec/openssh/sftp-server -l INFO",
  22.                    }
  23.         ) {
  24.           file { "sshd_config":
  25.                  name => "/etc/ssh/sshd_config",
  26.                  ensure  => file,
  27.                  mode => 640,
  28.                  owner => root,
  29.                  group => root,
  30.                  content => template("ssh/sshd_config.erb"),
  31.                  require => Package["ssh"],
  32.                  #notify => Service["sshd"]
  33.                 }
  34.           }
  35.      #
  36.      service { "sshd":
  37.           enable => true,
  38.           ensure => running,
  39.           hasrestart => true,
  40.           hasstatus => true,
  41.           subscribe => File[ "sshd_config" ],
  42.      }
  43. }
  44.  
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment