Skip to content

Commit 29a6cbc

Browse files
committed
Merge pull request #957 from derdanne/gentoo-compatibility
MODULES-1581: Gentoo compatibility
2 parents ce96036 + 5bc7a0b commit 29a6cbc

50 files changed

Lines changed: 750 additions & 50 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.fixtures.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ fixtures:
22
repositories:
33
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
44
concat: "git://github.com/puppetlabs/puppetlabs-concat.git"
5+
portage: "git://github.com/gentoo/puppet-portage.git"
56
symlinks:
67
apache: "#{source_dir}"

README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ Apache is a widely-used web server, and this module provides a simplified way of
6767
* Apache modules
6868
* virtual hosts
6969
* listened-to ports
70-
* `/etc/make.conf` on FreeBSD
70+
* `/etc/make.conf` on FreeBSD and Gentoo
71+
* depends on module 'gentoo/puppet-portage' for Gentoo
7172

7273
###Beginning with Apache
7374

@@ -77,7 +78,7 @@ To install Apache with the default parameters
7778
class { 'apache': }
7879
```
7980

80-
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
81+
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
8182

8283
```puppet
8384
class { 'apache':
@@ -236,11 +237,11 @@ Configures the behavior of the module templates, package names, and default mods
236237

237238
#####`conf_dir`
238239

239-
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.
240+
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.
240241

241242
#####`confd_dir`
242243

243-
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.
244+
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.
244245

245246
#####`conf_template`
246247

@@ -268,7 +269,7 @@ The default certificate authority, which is automatically set to 'undef'. This d
268269

269270
#####`default_ssl_cert`
270271

271-
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.
272+
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.
272273

273274
#####`default_ssl_chain`
274275

@@ -288,7 +289,7 @@ Sets the default certificate revocation check level via the [SSLCARevocationChec
288289

289290
#####`default_ssl_key`
290291

291-
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.
292+
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.
292293

293294
#####`default_ssl_vhost`
294295

@@ -313,15 +314,15 @@ Sets up a default virtual host. Defaults to 'true', set to 'false' to set up [cu
313314

314315
#####`docroot`
315316

316-
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.
317+
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.
317318

318319
#####`error_documents`
319320

320321
Enables custom error documents. Defaults to 'false'.
321322

322323
#####`httpd_dir`
323324

324-
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.
325+
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.
325326

326327
#####`keepalive`
327328

@@ -353,7 +354,7 @@ Define additional [LogFormats](https://httpd.apache.org/docs/current/mod/mod_log
353354

354355
#####`logroot`
355356

356-
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.
357+
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.
357358

358359
#####`logroot_mode`
359360

@@ -370,11 +371,11 @@ Setting this to 'false' stops the user resource from being created. This is for
370371

371372
#####`mod_dir`
372373

373-
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.
374+
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.
374375

375376
#####`mpm_module`
376377

377-
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:
378+
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:
378379

379380
* `apache::mod::event`
380381
* `apache::mod::itk`
@@ -414,7 +415,7 @@ Sets the server name. Defaults to `fqdn` provided by Facter.
414415

415416
#####`server_root`
416417

417-
Sets the root directory in which the server resides. Defaults to '/etc/httpd' on RedHat, '/etc/apache2' on Debian, and '/usr/local' on FreeBSD.
418+
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.
418419

419420
#####`server_signature`
420421

@@ -434,7 +435,7 @@ Determines whether the service should be running. Valid values are 'true', 'fals
434435

435436
#####`service_name`
436437

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

439440
#####`service_manage`
440441

@@ -446,7 +447,7 @@ Controls how TRACE requests per RFC 2616 are handled. More information about [Tr
446447

447448
#####`vhost_dir`
448449

449-
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.
450+
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.
450451

451452
#####`apache_name`
452453

@@ -1517,9 +1518,9 @@ Used by HTTPD to conditionally set environment variables for vhosts. Defaults to
15171518

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

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

1522-
`suphp_configpath` defaults to 'undef' on RedHat and FreeBSD, and '/etc/php5/apache2' on Debian.
1523+
`suphp_configpath` defaults to 'undef' on RedHat and FreeBSD, and '/etc/php5/apache2' on Debian and Gentoo.
15231524

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

@@ -2015,7 +2016,7 @@ Specifies the SSL certificate authority. Defaults to 'undef'.
20152016

20162017
#####`ssl_cert`
20172018

2018-
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.
2019+
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.
20192020

20202021
#####`ssl_protocol`
20212022

@@ -2035,7 +2036,7 @@ Sets [SSLHonorCipherOrder](http://httpd.apache.org/docs/current/mod/mod_ssl.html
20352036

20362037
#####`ssl_certs_dir`
20372038

2038-
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.
2039+
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.
20392040

20402041
#####`ssl_chain`
20412042

@@ -2055,7 +2056,7 @@ Sets the certificate revocation check level via the [SSLCARevocationCheck direct
20552056

20562057
#####`ssl_key`
20572058

2058-
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.)
2059+
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.)
20592060

20602061
#####`ssl_verify_client`
20612062

@@ -2473,7 +2474,7 @@ The `apache::mod::passenger` class is untested as the repository does not have p
24732474

24742475
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.
24752476

2476-
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.
2477+
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.
24772478

24782479
###SELinux and Custom Paths
24792480

manifests/default_mods.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@
2424
}
2525
default: {}
2626
}
27-
::apache::mod { 'authz_host': }
28-
27+
case $::osfamily {
28+
'gentoo': {}
29+
default: {
30+
::apache::mod { 'authz_host': }
31+
}
32+
}
2933
# The rest of the modules only get loaded if we want all modules enabled
3034
if $all {
3135
case $::osfamily {

manifests/init.pp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,23 @@
261261
$error_log = 'httpd-error.log'
262262
$scriptalias = '/usr/local/www/apache24/cgi-bin'
263263
$access_log_file = 'httpd-access.log'
264+
} 'gentoo': {
265+
$pidfile = '/run/apache2.pid'
266+
$error_log = 'error.log'
267+
$error_documents_path = '/usr/share/apache2/error'
268+
$scriptalias = '/var/www/localhost/cgi-bin'
269+
$access_log_file = 'access.log'
270+
271+
::portage::makeconf { 'apache2_modules':
272+
content => $default_mods,
273+
}
274+
file { [
275+
'/etc/apache2/modules.d/.keep_www-servers_apache-2',
276+
'/etc/apache2/vhosts.d/.keep_www-servers_apache-2'
277+
]:
278+
ensure => absent,
279+
require => Package['httpd'],
280+
}
264281
}
265282
default: {
266283
fail("Unsupported osfamily ${::osfamily}")

manifests/mod/alias.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
default => '/var/www/icons',
1111
},
1212
'freebsd' => '/usr/local/www/apache24/icons',
13+
'gentoo' => '/usr/share/apache2/icons',
1314
}
1415
apache::mod { 'alias': }
1516
# Template uses $icons_path

manifests/mod/disk_cache.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
'debian' => '/var/cache/apache2/mod_disk_cache',
44
'redhat' => '/var/cache/mod_proxy',
55
'freebsd' => '/var/cache/mod_disk_cache',
6+
'gentoo' => '/var/cache/apache2/mod_disk_cache',
67
}
78

89
$mod_name = $::osfamily ? {

manifests/mod/event.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959
apache_version => $apache_version,
6060
}
6161
}
62+
'gentoo': {
63+
::portage::makeconf { 'apache2_mpms':
64+
content => 'event',
65+
}
66+
}
6267
default: {
6368
fail("Unsupported osfamily ${::osfamily}")
6469
}

manifests/mod/itk.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
apache_version => $apache_version,
4949
}
5050
}
51+
'gentoo': {
52+
::portage::makeconf { 'apache2_mpms':
53+
content => 'itk',
54+
}
55+
}
5156
default: {
5257
fail("Unsupported osfamily ${::osfamily}")
5358
}

manifests/mod/peruser.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
fail("Unsupported osfamily ${::osfamily}")
1515
}
1616
default: {
17+
if $::osfamily == 'gentoo' {
18+
::portage::makeconf { 'apache2_mpms':
19+
content => 'peruser',
20+
}
21+
}
22+
1723
if defined(Class['apache::mod::event']) {
1824
fail('May not include both apache::mod::peruser and apache::mod::event on the same node')
1925
}

manifests/mod/prefork.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@
6565
apache_version => $apache_version,
6666
}
6767
}
68+
'gentoo': {
69+
::portage::makeconf { 'apache2_mpms':
70+
content => 'prefork',
71+
}
72+
}
6873
default: {
6974
fail("Unsupported osfamily ${::osfamily}")
7075
}

0 commit comments

Comments
 (0)