Added support for RHEL and did some syntax cleaning

Assume that "RedHat" also works where "CentOS" does.
This commit is contained in:
Ossi Salmi 2012-09-05 16:42:02 +03:00
parent e9aae1dcf6
commit 24ecb51f6f
63 changed files with 544 additions and 497 deletions

View file

@ -5,7 +5,7 @@ import "redhat.pp"
#
class apache::common {
case $operatingsystem {
case $::operatingsystem {
debian,ubuntu: {
if ! $httpd_user {
$user = "www-data"
@ -65,7 +65,7 @@ class apache::common {
}
package { "httpd":
name => $operatingsystem ? {
name => $::operatingsystem ? {
debian => "apache2",
ubuntu => "apache2",
default => "httpd",
@ -110,11 +110,11 @@ class apache::common {
#
class apache::server inherits apache::common {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
include apache::debian::server
}
centos,fedora: {
"centos","redhat","fedora": {
if ! $httpd_user {
$user = "apache"
} else {
@ -128,7 +128,7 @@ class apache::server inherits apache::common {
include apache::redhat::server
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -159,15 +159,15 @@ class apache::server inherits apache::common {
#
define apache::site($aliases="", $root="", $redirect="") {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::site { $name:
aliases => $aliases,
root => $root,
redirect => $redirect,
}
}
centos,fedora: {
"centos","redhat","fedora": {
apache::redhat::site { $name:
aliases => $aliases,
root => $root,
@ -175,7 +175,7 @@ define apache::site($aliases="", $root="", $redirect="") {
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -204,11 +204,11 @@ define apache::site($aliases="", $root="", $redirect="") {
#
class apache::sslserver inherits apache::common {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
include apache::debian::sslserver
}
centos,fedora: {
"centos","redhat","fedora": {
if ! $httpsd_user {
$user = "httpsd"
} else {
@ -222,7 +222,7 @@ class apache::sslserver inherits apache::common {
include apache::redhat::sslserver
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -271,8 +271,8 @@ define apache::sslsite($ipaddr="_default_", $root="", $ssl_cert="", $ssl_key="",
include apache::sslserver::listen
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
$apache_ssldir = "/etc/ssl"
apache::debian::sslsite { $name:
ipaddr => $ipaddr,
@ -283,7 +283,7 @@ define apache::sslsite($ipaddr="_default_", $root="", $ssl_cert="", $ssl_key="",
require => Class["apache::sslserver::listen"],
}
}
centos,fedora: {
"centos","redhat","fedora": {
$apache_ssldir = "/etc/pki/tls"
apache::redhat::sslsite { $name:
ipaddr => $ipaddr,
@ -295,7 +295,7 @@ define apache::sslsite($ipaddr="_default_", $root="", $ssl_cert="", $ssl_key="",
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -339,8 +339,8 @@ define apache::sslsite($ipaddr="_default_", $root="", $ssl_cert="", $ssl_key="",
#
define apache::configfile($source="", $content="", $http=true, $https=true) {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::configfile { $name:
source => $source,
content => $content,
@ -348,7 +348,7 @@ define apache::configfile($source="", $content="", $http=true, $https=true) {
https => $https,
}
}
centos,fedora: {
"centos","redhat","fedora": {
apache::redhat::configfile { $name:
source => $source,
content => $content,
@ -357,7 +357,7 @@ define apache::configfile($source="", $content="", $http=true, $https=true) {
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -386,13 +386,13 @@ class apache::mod::auth_kerb {
#
class apache::mod::authnz_ldap {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "authnz_ldap": }
}
centos,fedora: { }
"centos","redhat","fedora": { }
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -402,13 +402,13 @@ class apache::mod::authnz_ldap {
#
class apache::mod::include {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "include": }
}
centos,fedora: { }
"centos","redhat","fedora": { }
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -419,7 +419,7 @@ class apache::mod::include {
class apache::mod::fcgid {
package { "mod_fcgid":
name => $operatingsystem ? {
name => $::operatingsystem ? {
debian => "libapache2-mod-fcgid",
ubuntu => "libapache2-mod-fcgid",
default => "mod_fcgid",
@ -428,19 +428,19 @@ class apache::mod::fcgid {
require => Package["httpd"],
}
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "fcgid":
require => Package ["libapache2-mod-fcgid"],
}
}
centos,fedora: {
"centos","redhat","fedora": {
apache::configfile { "fcgid.conf":
require => Package["mod_fcgid"],
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -451,13 +451,13 @@ class apache::mod::fcgid {
#
class apache::mod::headers {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "headers": }
}
centos,fedora: { }
"centos","redhat","fedora": { }
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -468,13 +468,13 @@ class apache::mod::headers {
#
class apache::mod::ldap {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "ldap": }
}
centos,fedora: { }
"centos","redhat","fedora": { }
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -486,7 +486,7 @@ class apache::mod::ldap {
class apache::mod::perl {
package { "mod_perl":
name => $operatingsystem ? {
name => $::operatingsystem ? {
debian => "libapache2-mod-perl2",
ubuntu => "libapache2-mod-perl2",
default => "mod_perl",
@ -495,19 +495,19 @@ class apache::mod::perl {
require => Package["httpd"],
}
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "perl2":
require => Package ["libapache2-mod-perl2"],
}
}
centos,fedora: {
"centos","redhat","fedora": {
apache::configfile { "perl.conf":
require => Package["mod_perl"],
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -519,7 +519,7 @@ class apache::mod::perl {
class apache::mod::php {
package { "php":
name => $operatingsystem ? {
name => $::operatingsystem ? {
debian => "libapache2-mod-php5",
ubuntu => "libapache2-mod-php5",
default => "php",
@ -528,19 +528,19 @@ class apache::mod::php {
require => Package["httpd"],
}
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "php5":
require => Package ["libapache2-mod-php5"],
}
}
centos,fedora: {
"centos","redhat","fedora": {
apache::configfile { "php.conf":
require => Package["php"],
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -551,19 +551,19 @@ class apache::mod::php {
#
class apache::mod::proxy {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "proxy":
content => template("apache/proxy.conf.erb"),
}
}
centos,fedora: {
"centos","redhat","fedora": {
apache::configfile { "proxy.conf":
content => template("apache/proxy.conf.erb"),
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -574,13 +574,13 @@ class apache::mod::proxy {
#
class apache::mod::proxy_http {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "proxy_http": }
}
centos,fedora: { }
"centos","redhat","fedora": { }
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -591,13 +591,13 @@ class apache::mod::proxy_http {
#
class apache::mod::proxy_balancer {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "proxy_balancer": }
}
centos,fedora: { }
"centos","redhat","fedora": { }
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -609,7 +609,7 @@ class apache::mod::proxy_balancer {
class apache::mod::python {
package { "mod_python":
name => $operatingsystem ? {
name => $::operatingsystem ? {
debian => "libapache2-mod-python",
ubuntu => "libapache2-mod-python",
default => "mod_python",
@ -618,19 +618,19 @@ class apache::mod::python {
require => Package["httpd"],
}
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "python":
require => Package ["libapache2-mod-python"],
}
}
centos,fedora: {
"centos","redhat","fedora": {
apache::configfile { "python.conf":
require => Package["mod_python"],
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -641,13 +641,13 @@ class apache::mod::python {
#
class apache::mod::rewrite {
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "rewrite": }
}
centos,fedora: { }
"centos","redhat","fedora": { }
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -659,7 +659,7 @@ class apache::mod::rewrite {
class apache::mod::wsgi {
package { "mod_wsgi":
name => $operatingsystem ? {
name => $::operatingsystem ? {
debian => "libapache2-mod-wsgi",
ubuntu => "libapache2-mod-wsgi",
default => "mod_wsgi",
@ -668,19 +668,19 @@ class apache::mod::wsgi {
require => Package["httpd"],
}
case $operatingsystem {
debian,ubuntu: {
case $::operatingsystem {
"debian","ubuntu": {
apache::debian::a2enmod { "wsgi":
require => Package ["libapache2-mod-wsgi"],
}
}
centos,fedora: {
"centos","redhat","fedora": {
apache::configfile { "wsgi.conf":
require => Package["mod_wsgi"],
}
}
default: {
fail("Apache module not supported in ${operatingsystem}.")
fail("Apache module not supported in ${::operatingsystem}.")
}
}
@ -704,7 +704,7 @@ class apache::webalizer {
"/srv/www/webalizer/html", ]:
ensure => directory,
mode => "0755",
owner => $operatingsystem ? {
owner => $::operatingsystem ? {
debian => root,
ubuntu => root,
default => webalizer,
@ -729,7 +729,7 @@ class apache::webalizer {
source => "puppet:///modules/custom/empty",
}
case $operatingsystem {
case $::operatingsystem {
debian,ubuntu: {
file { "/etc/cron.daily/webalizer":
ensure => absent,
@ -757,7 +757,7 @@ class apache::webalizer {
ensure => present,
environment => "MAILTO=root",
command => "/usr/local/sbin/www-webalizer.sh",
user => $operatingsystem ? {
user => $::operatingsystem ? {
debian => root,
ubuntu => root,
default => webalizer,
@ -788,7 +788,7 @@ define apache::webalizer::site($site_proto, $site_fqdn) {
"/srv/www/webalizer/html/${name}", ]:
ensure => directory,
mode => "0755",
owner => $operatingsystem ? {
owner => $::operatingsystem ? {
debian => root,
ubuntu => root,
default => webalizer,

View file

@ -158,7 +158,7 @@ class apache::redhat::sslserver {
notify => Service["httpsd"],
}
case $operatingsystem {
case $::operatingsystem {
"fedora": {
file { "/lib/systemd/system/httpsd.service":
ensure => present,

View file

@ -193,7 +193,7 @@ LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
<% if operatingsystem == 'CentOS' and operatingsystemrelease =~ /^[1-5]\./ -%>
<% if ['CentOS','RedHat'].index(operatingsystem) and operatingsystemrelease =~ /^[1-5]\./ -%>
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
<% end -%>

View file

@ -193,7 +193,7 @@ LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
<% if operatingsystem == 'CentOS' and operatingsystemrelease =~ /^[1-5]\./ -%>
<% if ['CentOS','RedHat'].index(operatingsystem) and operatingsystemrelease =~ /^[1-5]\./ -%>
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
<% end -%>

View file

@ -3,7 +3,7 @@ LoadModule ssl_module modules/mod_ssl.so
</IfModule>
Listen 443
<% if operatingsystem == 'CentOS' or operatingsystem == 'Fedora' -%>
<% if ['CentOS','RedHat'].index(operatingsystem) or operatingsystem == 'Fedora' -%>
##
## SSL Global Context
##