Skip to content

Commit

Permalink
add gentoo compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
derdanne committed Feb 24, 2015
1 parent 19802cb commit 5bc7a0b
Show file tree
Hide file tree
Showing 50 changed files with 750 additions and 50 deletions.
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ fixtures:
repositories:
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
concat: "git://github.com/puppetlabs/puppetlabs-concat.git"
portage: "git://github.com/gentoo/puppet-portage.git"
symlinks:
apache: "#{source_dir}"
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ Apache is a widely-used web server, and this module provides a simplified way of
* Apache modules
* virtual hosts
* listened-to ports
* `/etc/make.conf` on FreeBSD
* `/etc/make.conf` on FreeBSD and Gentoo
* depends on module 'gentoo/puppet-portage' for Gentoo

###Beginning with Apache

Expand All @@ -79,7 +80,7 @@ To install Apache with the default parameters
class { 'apache': }
```

The defaults are determined by your operating system (e.g. Debian systems have one set of defaults, and RedHat systems have another, as do FreeBSD systems). These defaults work well in a testing environment, but are not suggested for production. To establish customized parameters
The defaults are determined by your operating system (e.g. Debian systems have one set of defaults, and RedHat systems have another, as do FreeBSD and Gentoo systems). These defaults work well in a testing environment, but are not suggested for production. To establish customized parameters

```puppet
class { 'apache':
Expand Down Expand Up @@ -238,11 +239,11 @@ Configures the behavior of the module templates, package names, and default mods

#####`conf_dir`

Changes the location of the configuration directory the main configuration file is placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2' on Debian, and '/usr/local/etc/apache22' on FreeBSD.
Changes the location of the configuration directory the main configuration file is placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2' on Debian, '/usr/local/etc/apache22' on FreeBSD, and '/etc/apache2' on Gentoo.

#####`confd_dir`

Changes the location of the configuration directory your custom configuration files are placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2/conf.d' on Debian, and '/usr/local/etc/apache22' on FreeBSD.
Changes the location of the configuration directory your custom configuration files are placed in. Defaults to '/etc/httpd/conf' on RedHat, '/etc/apache2/conf.d' on Debian, '/usr/local/etc/apache22' on FreeBSD, and '/etc/apache2/conf.d' on Gentoo.

#####`conf_template`

Expand Down Expand Up @@ -270,7 +271,7 @@ The default certificate authority, which is automatically set to 'undef'. This d

#####`default_ssl_cert`

The default SSL certification, which is automatically set based on your operating system ('/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, and '/usr/local/etc/apache22/server.crt' for FreeBSD). This default works out of the box but must be updated with your specific certificate information before being used in production.
The default SSL certification, which is automatically set based on your operating system ('/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, '/usr/local/etc/apache22/server.crt' for FreeBSD, and '/etc/ssl/apache2/server.crt' for Gentoo). This default works out of the box but must be updated with your specific certificate information before being used in production.

#####`default_ssl_chain`

Expand All @@ -290,7 +291,7 @@ Sets the default certificate revocation check level via the [SSLCARevocationChec

#####`default_ssl_key`

The default SSL key, which is automatically set based on your operating system ('/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, and '/usr/local/etc/apache22/server.key' for FreeBSD). This default works out of the box but must be updated with your specific certificate information before being used in production.
The default SSL key, which is automatically set based on your operating system ('/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, '/usr/local/etc/apache22/server.key' for FreeBSD, and '/etc/ssl/apache2/server.key' for Gentoo). This default works out of the box but must be updated with your specific certificate information before being used in production.

#####`default_ssl_vhost`

Expand All @@ -315,15 +316,15 @@ Sets up a default virtual host. Defaults to 'true', set to 'false' to set up [cu

#####`docroot`

Changes the location of the default [Documentroot](https://httpd.apache.org/docs/current/mod/core.html#documentroot). Defaults to '/var/www/html' on RedHat, '/var/www' on Debian, and '/usr/local/www/apache22/data' on FreeBSD.
Changes the location of the default [Documentroot](https://httpd.apache.org/docs/current/mod/core.html#documentroot). Defaults to '/var/www/html' on RedHat, '/var/www' on Debian, '/usr/local/www/apache22/data' on FreeBSD, and '/var/www/localhost/htdocs' on Gentoo.

#####`error_documents`

Enables custom error documents. Defaults to 'false'.

#####`httpd_dir`

Changes the base location of the configuration directories used for the apache service. This is useful for specially repackaged HTTPD builds, but might have unintended consequences when used in combination with the default distribution packages. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, and '/usr/local/etc/apache22' on FreeBSD.
Changes the base location of the configuration directories used for the apache service. This is useful for specially repackaged HTTPD builds, but might have unintended consequences when used in combination with the default distribution packages. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, '/usr/local/etc/apache22' on FreeBSD, and '/etc/apache2' on Gentoo.

#####`keepalive`

Expand Down Expand Up @@ -355,7 +356,7 @@ Define additional [LogFormats](https://httpd.apache.org/docs/current/mod/mod_log

#####`logroot`

Changes the directory where Apache log files for the virtual host are placed. Defaults to '/var/log/httpd' on RedHat, '/var/log/apache2' on Debian, and '/var/log/apache22' on FreeBSD.
Changes the directory where Apache log files for the virtual host are placed. Defaults to '/var/log/httpd' on RedHat, '/var/log/apache2' on Debian, '/var/log/apache22' on FreeBSD, and '/var/log/apache2' on Gentoo.

#####`logroot_mode`

Expand All @@ -372,11 +373,11 @@ Setting this to 'false' stops the user resource from being created. This is for

#####`mod_dir`

Changes the location of the configuration directory your Apache modules configuration files are placed in. Defaults to '/etc/httpd/conf.d' for RedHat, '/etc/apache2/mods-available' for Debian, and '/usr/local/etc/apache22/Modules' for FreeBSD.
Changes the location of the configuration directory your Apache modules configuration files are placed in. Defaults to '/etc/httpd/conf.d' for RedHat, '/etc/apache2/mods-available' for Debian, '/usr/local/etc/apache22/Modules' for FreeBSD, and '/etc/apache2/modules.d' on Gentoo.

#####`mpm_module`

Determines which MPM is loaded and configured for the HTTPD process. Valid values are 'event', 'itk', 'peruser', 'prefork', 'worker', or 'false'. Defaults to 'prefork' on RedHat and FreeBSD, and 'worker' on Debian. Must be set to 'false' to explicitly declare the following classes with custom parameters:
Determines which MPM is loaded and configured for the HTTPD process. Valid values are 'event', 'itk', 'peruser', 'prefork', 'worker', or 'false'. Defaults to 'prefork' on RedHat, FreeBSD and Gentoo, and 'worker' on Debian. Must be set to 'false' to explicitly declare the following classes with custom parameters:

* `apache::mod::event`
* `apache::mod::itk`
Expand Down Expand Up @@ -416,7 +417,7 @@ Sets the server name. Defaults to `fqdn` provided by Facter.

#####`server_root`

Sets the root directory in which the server resides. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, and '/usr/local' on FreeBSD.
Sets the root directory in which the server resides. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, '/usr/local' on FreeBSD, and '/var/www' on Gentoo.

#####`server_signature`

Expand All @@ -436,7 +437,7 @@ Determines whether the service should be running. Valid values are 'true', 'fals

#####`service_name`

Name of the Apache service to run. Defaults to: 'httpd' on RedHat, 'apache2' on Debian, and 'apache22' on FreeBSD.
Name of the Apache service to run. Defaults to: 'httpd' on RedHat, 'apache2' on Debian and Gentoo, and 'apache22' on FreeBSD.

#####`service_manage`

Expand All @@ -448,7 +449,7 @@ Controls how TRACE requests per RFC 2616 are handled. More information about [Tr

#####`vhost_dir`

Changes the location of the configuration directory your virtual host configuration files are placed in. Defaults to 'etc/httpd/conf.d' on RedHat, '/etc/apache2/sites-available' on Debian, and '/usr/local/etc/apache22/Vhosts' on FreeBSD.
Changes the location of the configuration directory your virtual host configuration files are placed in. Defaults to 'etc/httpd/conf.d' on RedHat, '/etc/apache2/sites-available' on Debian, '/usr/local/etc/apache22/Vhosts' on FreeBSD, and '/etc/apache2/vhosts.d' on Gentoo.

#####`apache_name`

Expand Down Expand Up @@ -1515,9 +1516,9 @@ Used by HTTPD to conditionally set environment variables for vhosts. Defaults to

Set up a virtual host with [suPHP](http://suphp.org/DocumentationView.html?file=apache/CONFIG).

`suphp_addhandler` defaults to 'php5-script' on RedHat and FreeBSD, and 'x-httpd-php' on Debian.
`suphp_addhandler` defaults to 'php5-script' on RedHat and FreeBSD, and 'x-httpd-php' on Debian and Gentoo.

`suphp_configpath` defaults to 'undef' on RedHat and FreeBSD, and '/etc/php5/apache2' on Debian.
`suphp_configpath` defaults to 'undef' on RedHat and FreeBSD, and '/etc/php5/apache2' on Debian and Gentoo.

`suphp_engine` allows values 'on' or 'off'. Defaults to 'off'

Expand Down Expand Up @@ -2013,7 +2014,7 @@ Specifies the SSL certificate authority. Defaults to 'undef'.

#####`ssl_cert`

Specifies the SSL certification. Defaults are based on your OS: '/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, and '/usr/local/etc/apache22/server.crt' for FreeBSD.
Specifies the SSL certification. Defaults are based on your OS: '/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, '/usr/local/etc/apache22/server.crt' for FreeBSD, and '/etc/ssl/apache2/server.crt' on Gentoo.

#####`ssl_protocol`

Expand All @@ -2033,7 +2034,7 @@ Sets [SSLHonorCipherOrder](http://httpd.apache.org/docs/current/mod/mod_ssl.html

#####`ssl_certs_dir`

Specifies the location of the SSL certification directory. Defaults to '/etc/ssl/certs' on Debian, '/etc/pki/tls/certs' on RedHat, and '/usr/local/etc/apache22' on FreeBSD.
Specifies the location of the SSL certification directory. Defaults to '/etc/ssl/certs' on Debian, '/etc/pki/tls/certs' on RedHat, '/usr/local/etc/apache22' on FreeBSD, and '/etc/ssl/apache2' on Gentoo.

#####`ssl_chain`

Expand All @@ -2053,7 +2054,7 @@ Sets the certificate revocation check level via the [SSLCARevocationCheck direct

#####`ssl_key`

Specifies the SSL key. Defaults are based on your operating system: '/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, and '/usr/local/etc/apache22/server.key' for FreeBSD. (This default works out of the box but must be updated in the base `apache` class with your specific certificate information before being used in production.)
Specifies the SSL key. Defaults are based on your operating system: '/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, '/usr/local/etc/apache22/server.key' for FreeBSD, and '/etc/ssl/apache2/server.key' on Gentoo. (This default works out of the box but must be updated in the base `apache` class with your specific certificate information before being used in production.)

#####`ssl_verify_client`

Expand Down Expand Up @@ -2471,7 +2472,7 @@ The `apache::mod::passenger` class is untested as the repository does not have p

This module is CI tested on Centos 5 & 6, Ubuntu 12.04 & 14.04, Debian 7, and RHEL 5, 6 & 7 platforms against both the OSS and Enterprise version of Puppet.

The module contains support for other distributions and operating systems, such as FreeBSD and Amazon Linux, but is not formally tested on those and regressions can occur.
The module contains support for other distributions and operating systems, such as FreeBSD, Gentoo and Amazon Linux, but is not formally tested on those and regressions can occur.

###SELinux and Custom Paths

Expand Down
8 changes: 6 additions & 2 deletions manifests/default_mods.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@
}
default: {}
}
::apache::mod { 'authz_host': }

case $::osfamily {
'gentoo': {}
default: {
::apache::mod { 'authz_host': }
}
}
# The rest of the modules only get loaded if we want all modules enabled
if $all {
case $::osfamily {
Expand Down
17 changes: 17 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,23 @@
$error_log = 'httpd-error.log'
$scriptalias = '/usr/local/www/apache24/cgi-bin'
$access_log_file = 'httpd-access.log'
} 'gentoo': {
$pidfile = '/run/apache2.pid'
$error_log = 'error.log'
$error_documents_path = '/usr/share/apache2/error'
$scriptalias = '/var/www/localhost/cgi-bin'
$access_log_file = 'access.log'

::portage::makeconf { 'apache2_modules':
content => $default_mods,
}
file { [
'/etc/apache2/modules.d/.keep_www-servers_apache-2',
'/etc/apache2/vhosts.d/.keep_www-servers_apache-2'
]:
ensure => absent,
require => Package['httpd'],
}
}
default: {
fail("Unsupported osfamily ${::osfamily}")
Expand Down
1 change: 1 addition & 0 deletions manifests/mod/alias.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
default => '/var/www/icons',
},
'freebsd' => '/usr/local/www/apache24/icons',
'gentoo' => '/usr/share/apache2/icons',
}
apache::mod { 'alias': }
# Template uses $icons_path
Expand Down
1 change: 1 addition & 0 deletions manifests/mod/disk_cache.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
'debian' => '/var/cache/apache2/mod_disk_cache',
'redhat' => '/var/cache/mod_proxy',
'freebsd' => '/var/cache/mod_disk_cache',
'gentoo' => '/var/cache/apache2/mod_disk_cache',
}

$mod_name = $::osfamily ? {
Expand Down
5 changes: 5 additions & 0 deletions manifests/mod/event.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
apache_version => $apache_version,
}
}
'gentoo': {
::portage::makeconf { 'apache2_mpms':
content => 'event',
}
}
default: {
fail("Unsupported osfamily ${::osfamily}")
}
Expand Down
5 changes: 5 additions & 0 deletions manifests/mod/itk.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
apache_version => $apache_version,
}
}
'gentoo': {
::portage::makeconf { 'apache2_mpms':
content => 'itk',
}
}
default: {
fail("Unsupported osfamily ${::osfamily}")
}
Expand Down
6 changes: 6 additions & 0 deletions manifests/mod/peruser.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
fail("Unsupported osfamily ${::osfamily}")
}
default: {
if $::osfamily == 'gentoo' {
::portage::makeconf { 'apache2_mpms':
content => 'peruser',
}
}

if defined(Class['apache::mod::event']) {
fail('May not include both apache::mod::peruser and apache::mod::event on the same node')
}
Expand Down
5 changes: 5 additions & 0 deletions manifests/mod/prefork.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
apache_version => $apache_version,
}
}
'gentoo': {
::portage::makeconf { 'apache2_mpms':
content => 'prefork',
}
}
default: {
fail("Unsupported osfamily ${::osfamily}")
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/mod/proxy_html.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Add libxml2
case $::osfamily {
/RedHat|FreeBSD/: {
/RedHat|FreeBSD|Gentoo/: {
::apache::mod { 'xml2enc': }
$loadfiles = undef
}
Expand Down
4 changes: 4 additions & 0 deletions manifests/mod/ssl.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'debian' => "\${APACHE_RUN_DIR}/ssl_scache(512000)",
'redhat' => '/var/cache/mod_ssl/scache(512000)',
'freebsd' => '/var/run/ssl_scache(512000)',
'gentoo' => '/var/run/ssl_scache(512000)',
}

case $::osfamily {
Expand All @@ -35,6 +36,9 @@
'freebsd': {
$ssl_mutex = 'default'
}
'gentoo': {
$ssl_mutex = 'default'
}
default: {
fail("Unsupported osfamily ${::osfamily}")
}
Expand Down
5 changes: 5 additions & 0 deletions manifests/mod/worker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@
apache_version => $apache_version,
}
}
'gentoo': {
::portage::makeconf { 'apache2_mpms':
content => 'worker',
}
}
default: {
fail("Unsupported osfamily ${::osfamily}")
}
Expand Down
61 changes: 61 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,67 @@
$wsgi_socket_prefix = undef
$docroot = '/usr/local/www/apache24/data'
$error_documents_path = '/usr/local/www/apache24/error'
} elsif $::osfamily == 'Gentoo' {
$user = 'apache'
$group = 'apache'
$root_group = 'wheel'
$apache_name = 'www-servers/apache'
$service_name = 'apache2'
$httpd_dir = '/etc/apache2'
$server_root = '/var/www'
$conf_dir = $httpd_dir
$confd_dir = "${httpd_dir}/conf.d"
$mod_dir = "${httpd_dir}/modules.d"
$mod_enable_dir = undef
$vhost_dir = "${httpd_dir}/vhosts.d"
$vhost_enable_dir = undef
$conf_file = 'httpd.conf'
$ports_file = "${conf_dir}/ports.conf"
$logroot = '/var/log/apache2'
$logroot_mode = undef
$lib_path = '/usr/lib/apache2/modules'
$mpm_module = 'prefork'
$dev_packages = undef
$default_ssl_cert = '/etc/ssl/apache2/server.crt'
$default_ssl_key = '/etc/ssl/apache2/server.key'
$ssl_certs_dir = '/etc/ssl/apache2'
$passenger_root = '/usr'
$passenger_ruby = '/usr/bin/ruby'
$passenger_conf_file = 'passenger.conf'
$passenger_conf_package_file = undef
$passenger_default_ruby = undef
$suphp_addhandler = 'x-httpd-php'
$suphp_engine = 'off'
$suphp_configpath = '/etc/php5/apache2'
$mod_packages = {
# NOTE: I list here only modules that are not included in www-servers/apache
'auth_kerb' => 'www-apache/mod_auth_kerb',
'fcgid' => 'www-apache/mod_fcgid',
'passenger' => 'www-apache/passenger',
'perl' => 'www-apache/mod_perl',
'php5' => 'dev-lang/php',
'proxy_html' => 'www-apache/mod_proxy_html',
'proxy_fcgi' => 'www-apache/mod_proxy_fcgi',
'python' => 'www-apache/mod_python',
'wsgi' => 'www-apache/mod_wsgi',
'dav_svn' => 'dev-vcs/subversion',
'xsendfile' => 'www-apache/mod_xsendfile',
'rpaf' => 'www-apache/mod_rpaf',
'xml2enc' => 'www-apache/mod_xml2enc',
}
$mod_libs = {
'php5' => 'libphp5.so',
}
$conf_template = 'apache/httpd.conf.erb'
$keepalive = 'Off'
$keepalive_timeout = 15
$max_keepalive_requests = 100
$fastcgi_lib_path = undef # TODO: revisit
$mime_support_package = 'app-misc/mime-types'
$mime_types_config = '/etc/mime.types'
$wsgi_socket_prefix = undef
$docroot = '/var/www/localhost/htdocs'
$error_documents_path = '/usr/share/apache2/error'
} else {
fail("Class['apache::params']: Unsupported osfamily: ${::osfamily}")
}
Expand Down
3 changes: 3 additions & 0 deletions manifests/version.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
'FreeBSD': {
$default = '2.4'
}
'Gentoo': {
$default = '2.4'
}
default: {
fail("Class['apache::version']: Unsupported osfamily: ${::osfamily}")
}
Expand Down
Loading

0 comments on commit 5bc7a0b

Please sign in to comment.