From e98359bd240ac546a5c866f484de04587c4d7fa1 Mon Sep 17 00:00:00 2001 From: Christophe Vanlancker Date: Tue, 12 May 2015 14:30:34 +0200 Subject: [PATCH] Add basic initial support for SLES 11 Signed-off-by: Christophe Vanlancker --- manifests/default_mods.pp | 3 ++ manifests/init.pp | 6 ++++ manifests/mod.pp | 35 +++++++++++++++++++++++ manifests/mod/alias.pp | 1 + manifests/mod/prefork.pp | 2 +- manifests/mod/worker.pp | 2 +- manifests/mpm.pp | 32 +++++++++++++++++++++ manifests/params.pp | 60 +++++++++++++++++++++++++++++++++++++++ manifests/version.pp | 3 ++ 9 files changed, 142 insertions(+), 2 deletions(-) diff --git a/manifests/default_mods.pp b/manifests/default_mods.pp index 145c4feeb..d609707b2 100644 --- a/manifests/default_mods.pp +++ b/manifests/default_mods.pp @@ -22,6 +22,9 @@ ::apache::mod { 'log_config': } ::apache::mod { 'unixd': } } + 'Suse': { + ::apache::mod { 'log_config': } + } default: {} } case $::osfamily { diff --git a/manifests/init.pp b/manifests/init.pp index 22b2361ae..9e6da9813 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -281,6 +281,12 @@ require => Package['httpd'], } } + 'Suse': { + $pidfile = '/var/run/httpd2.pid' + $error_log = 'error.log' + $scriptalias = '/usr/lib/cgi-bin' + $access_log_file = 'access.log' + } default: { fail("Unsupported osfamily ${::osfamily}") } diff --git a/manifests/mod.pp b/manifests/mod.pp index bc52d2e20..920114a7c 100644 --- a/manifests/mod.pp +++ b/manifests/mod.pp @@ -126,5 +126,40 @@ notify => Class['apache::service'], } } + } elsif $::osfamily == 'Suse' { + $enable_dir = $::apache::mod_enable_dir + file{ "${_loadfile_name} symlink": + ensure => link, + path => "${enable_dir}/${_loadfile_name}", + target => "${mod_dir}/${_loadfile_name}", + owner => 'root', + group => $::apache::params::root_group, + mode => '0644', + require => [ + File[$_loadfile_name], + Exec["mkdir ${enable_dir}"], + ], + before => File[$enable_dir], + notify => Class['apache::service'], + } + # Each module may have a .conf file as well, which should be + # defined in the class apache::mod::module + # Some modules do not require this file. + if defined(File["${mod}.conf"]) { + file{ "${mod}.conf symlink": + ensure => link, + path => "${enable_dir}/${mod}.conf", + target => "${mod_dir}/${mod}.conf", + owner => 'root', + group => $::apache::params::root_group, + mode => '0644', + require => [ + File["${mod}.conf"], + Exec["mkdir ${enable_dir}"], + ], + before => File[$enable_dir], + notify => Class['apache::service'], + } + } } } diff --git a/manifests/mod/alias.pp b/manifests/mod/alias.pp index c1f60fd62..2f078f645 100644 --- a/manifests/mod/alias.pp +++ b/manifests/mod/alias.pp @@ -6,6 +6,7 @@ $icons_path = $::osfamily ? { 'debian' => '/usr/share/apache2/icons', + 'Suse' => '/usr/share/apache2/icons', 'redhat' => $ver24 ? { true => '/usr/share/httpd/icons', default => '/var/www/icons', diff --git a/manifests/mod/prefork.pp b/manifests/mod/prefork.pp index 035e8818a..91567de11 100644 --- a/manifests/mod/prefork.pp +++ b/manifests/mod/prefork.pp @@ -60,7 +60,7 @@ } } } - 'debian', 'freebsd' : { + 'debian', 'freebsd', 'Suse' : { ::apache::mpm{ 'prefork': apache_version => $apache_version, } diff --git a/manifests/mod/worker.pp b/manifests/mod/worker.pp index 02a1beae3..25925f807 100644 --- a/manifests/mod/worker.pp +++ b/manifests/mod/worker.pp @@ -62,7 +62,7 @@ } } } - 'debian', 'freebsd': { + 'debian', 'freebsd', 'Suse': { ::apache::mpm{ 'worker': apache_version => $apache_version, } diff --git a/manifests/mpm.pp b/manifests/mpm.pp index 2478184f5..9e7734945 100644 --- a/manifests/mpm.pp +++ b/manifests/mpm.pp @@ -68,6 +68,38 @@ 'redhat': { # so we don't fail } + 'Suse': { + file { "${::apache::mod_enable_dir}/${mpm}.conf": + ensure => link, + target => "${::apache::mod_dir}/${mpm}.conf", + require => Exec["mkdir ${::apache::mod_enable_dir}"], + before => File[$::apache::mod_enable_dir], + notify => Class['apache::service'], + } + + if versioncmp($apache_version, '2.4') >= 0 { + file { "${::apache::mod_enable_dir}/${mpm}.load": + ensure => link, + target => "${::apache::mod_dir}/${mpm}.load", + require => Exec["mkdir ${::apache::mod_enable_dir}"], + before => File[$::apache::mod_enable_dir], + notify => Class['apache::service'], + } + + if $mpm == 'itk' { + file { "${lib_path}/mod_mpm_itk.so": + ensure => link, + target => "${lib_path}/mpm_itk.so" + } + } + } + + if versioncmp($apache_version, '2.4') < 0 { + package { "apache2-${mpm}": + ensure => present, + } + } + } default: { fail("Unsupported osfamily ${::osfamily}") } diff --git a/manifests/params.pp b/manifests/params.pp index ce5edec12..b5d142136 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -417,6 +417,66 @@ $wsgi_socket_prefix = undef $docroot = '/var/www/localhost/htdocs' $error_documents_path = '/usr/share/apache2/error' + } elsif $::osfamily == 'Suse' { + $user = 'wwwrun' + $group = 'wwwrun' + $root_group = 'root' + $apache_name = 'apache2' + $service_name = 'apache2' + $httpd_dir = '/etc/apache2' + $server_root = '/etc/apache2' + $conf_dir = $httpd_dir + $confd_dir = "${httpd_dir}/conf.d" + $mod_dir = "${httpd_dir}/mods-available" + $mod_enable_dir = "${httpd_dir}/mods-enabled" + $vhost_dir = "${httpd_dir}/sites-available" + $vhost_enable_dir = "${httpd_dir}/sites-enabled" + $conf_file = 'httpd.conf' + $ports_file = "${conf_dir}/ports.conf" + $logroot = '/var/log/apache2' + $logroot_mode = undef + $lib_path = '/usr/lib64/apache2-prefork/' + $mpm_module = 'prefork' + $default_ssl_cert = '/etc/ssl/certs/ssl-cert-snakeoil.pem' + $default_ssl_key = '/etc/ssl/private/ssl-cert-snakeoil.key' + $ssl_certs_dir = '/etc/ssl/certs' + $suphp_addhandler = 'x-httpd-php' + $suphp_engine = 'off' + $suphp_configpath = '/etc/php5/apache2' + $mod_packages = { + 'auth_kerb' => 'apache2-mod_auth_kerb', + 'fcgid' => 'apache2-mod_fcgid', + 'perl' => 'apache2-mod_perl', + 'php5' => 'apache2-mod_php53', + 'python' => 'apache2-mod_python', + } + $mod_libs = { + 'php5' => 'libphp5.so', + } + $conf_template = 'apache/httpd.conf.erb' + $keepalive = 'Off' + $keepalive_timeout = 15 + $max_keepalive_requests = 100 + $fastcgi_lib_path = '/var/lib/apache2/fastcgi' + $mime_support_package = 'aaa_base' + $mime_types_config = '/etc/mime.types' + $docroot = '/srv/www' + $cas_cookie_path = '/var/cache/apache2/mod_auth_cas/' + $error_documents_path = '/usr/share/apache2/error' + $dev_packages = ['libapr-util1-devel', 'libapr1-devel'] + + # + # Passenger-specific settings + # + + $passenger_conf_file = 'passenger.conf' + $passenger_conf_package_file = undef + + $passenger_root = '/usr' + $passenger_ruby = '/usr/bin/ruby' + $passenger_default_ruby = undef + $wsgi_socket_prefix = undef + } else { fail("Class['apache::params']: Unsupported osfamily: ${::osfamily}") } diff --git a/manifests/version.pp b/manifests/version.pp index ce3b90769..bdf1629b0 100644 --- a/manifests/version.pp +++ b/manifests/version.pp @@ -33,6 +33,9 @@ 'Gentoo': { $default = '2.4' } + 'Suse': { + $default = '2.2' + } default: { fail("Class['apache::version']: Unsupported osfamily: ${::osfamily}") }