Skip to content

Instantly share code, notes, and snippets.

@WhatsARanjit
Created June 30, 2014 13:53
Show Gist options
  • Save WhatsARanjit/dcc4a656e8643c9bb90d to your computer and use it in GitHub Desktop.
Save WhatsARanjit/dcc4a656e8643c9bb90d to your computer and use it in GitHub Desktop.
MASTER
class ssh::install {
package { $ssh::params::ssh_packages :
ensure => installed,
}
}
class ssh::config {
file { '/etc/ssh/sshd_config':
ensure => present,
owner => 'root',
group => 'root',
mode => '0600',
source => "puppet://$puppetserver/modules/ssh/sshd_config",
}
}
class ssh::service {
service { 'sshd':
name => $operatingsystem ? {
centos => 'sshd',
ubuntu => 'ssh',
default => 'ssh',
},
ensure => running,
enable => true,
}
}
class ssh::params {
case $operatingsystem {
'CentOS': {
$ssh_packages = [ 'openssh', 'openssh-server', 'openssh-clients' ]
}
'ubuntu': {
$ssh_packages = [ 'openssh-server', 'openssh-client' ]
}
default: {
fail("Login class does not work on opeating system: $operatingsystem")
}
}
}
class ssh {
class { 'ssh::params': } ->
class { 'ssh::install': } ->
class { 'ssh::config': } ~>
class { 'ssh::service': }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment