2013-10-13 17:15:35 +02:00
|
|
|
# Class: apache
|
|
|
|
#
|
|
|
|
# This class installs the apache server.
|
|
|
|
#
|
|
|
|
# Parameters:
|
|
|
|
#
|
|
|
|
# Actions:
|
|
|
|
#
|
|
|
|
# Requires:
|
|
|
|
#
|
|
|
|
# Sample Usage:
|
|
|
|
#
|
|
|
|
# include apache
|
|
|
|
#
|
|
|
|
class apache {
|
|
|
|
$apache = $::operatingsystem ? {
|
|
|
|
/(Debian|Ubuntu)/ => 'apache2',
|
|
|
|
/(RedHat|CentOS|Fedora)/ => 'httpd'
|
|
|
|
}
|
|
|
|
|
|
|
|
package { $apache:
|
|
|
|
ensure => installed,
|
2013-10-15 10:12:30 +02:00
|
|
|
alias => 'apache'
|
2013-10-13 17:15:35 +02:00
|
|
|
}
|
|
|
|
|
2013-10-15 09:36:29 +02:00
|
|
|
exec { 'iptables-allow-http':
|
2013-10-15 10:12:30 +02:00
|
|
|
path => '/bin:/usr/bin:/sbin:/usr/sbin',
|
2013-10-16 08:25:11 +02:00
|
|
|
unless => 'grep -Fxqe "-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT" /etc/sysconfig/iptables',
|
2013-10-15 09:36:29 +02:00
|
|
|
command => 'lokkit --enabled --service=http'
|
|
|
|
}
|
|
|
|
|
2013-10-13 17:15:35 +02:00
|
|
|
service { $apache:
|
2013-10-15 10:12:30 +02:00
|
|
|
enable => true,
|
|
|
|
ensure => running,
|
|
|
|
alias => 'apache',
|
2013-10-15 09:36:29 +02:00
|
|
|
require => [ Package['apache'], Exec['iptables-allow-http'] ]
|
2013-10-13 17:15:35 +02:00
|
|
|
}
|
|
|
|
}
|