Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename the apache_httpd module and clean it up for forge inclusion

  • Loading branch information...
commit b061c385a703b1c28ce05bcf9c70e80d759f0374 1 parent 538d6b0
@thias authored
Showing with 158 additions and 99 deletions.
  1. +0 −2  modules/apache-httpd/Modulefile
  2. +0 −29 modules/apache-httpd/manifests/file.pp
  3. +0 −22 modules/apache-httpd/manifests/service/ssl.pp
  4. +0 −4 modules/apache-httpd/tests/file.pp
  5. +0 −7 modules/apache-httpd/tests/init.pp
  6. +6 −0 modules/apache_httpd/ChangeLog
  7. +14 −0 modules/apache_httpd/LICENSE
  8. +9 −0 modules/apache_httpd/Modulefile
  9. +5 −14 modules/{apache-httpd → apache_httpd}/README
  10. 0  modules/{apache-httpd → apache_httpd}/files/proxy_ajp.conf
  11. 0  modules/{apache-httpd → apache_httpd}/files/proxy_ajp.conf.orig
  12. 0  modules/{apache-httpd → apache_httpd}/files/trace.inc
  13. 0  modules/{apache-httpd → apache_httpd}/files/welcome.conf
  14. +50 −0 modules/apache_httpd/manifests/file.pp
  15. +23 −18 modules/{apache-httpd → apache_httpd}/manifests/init.pp
  16. +5 −3 modules/{apache-httpd → apache_httpd}/manifests/service/base.pp
  17. +26 −0 modules/apache_httpd/manifests/service/ssl.pp
  18. 0  modules/{apache-httpd → apache_httpd}/templates/conf.d/ssl.conf
  19. 0  modules/{apache-httpd → apache_httpd}/templates/conf.d/ssl.conf.orig
  20. 0  modules/{apache-httpd → apache_httpd}/templates/conf/httpd.conf.erb
  21. 0  modules/{apache-httpd → apache_httpd}/templates/conf/httpd.conf.orig
  22. 0  modules/{apache-httpd → apache_httpd}/templates/etc/logrotate.erb
  23. 0  modules/{apache-httpd → apache_httpd}/templates/etc/sysconfig.erb
  24. +9 −0 modules/apache_httpd/tests/file.pp
  25. +11 −0 modules/apache_httpd/tests/init.pp
View
2  modules/apache-httpd/Modulefile
@@ -1,2 +0,0 @@
-name 'apache-httpd'
-version '0.2.2'
View
29 modules/apache-httpd/manifests/file.pp
@@ -1,29 +0,0 @@
-# Apache httpd server configuration file definition.
-#
-# Sample Usage :
-# apache-httpd::file { 'www.example.com.conf':
-# source => 'puppet:///files/apache-httpd/www.example.com.conf',
-# }
-#
-define apache-httpd::file (
- $confd = '/etc/httpd/conf.d',
- $owner = 'root',
- $group = 'root',
- $mode = '0644',
- $source = undef,
- $content = undef,
- $ensure = undef
-) {
- file { "${confd}/${title}":
- ensure => $ensure,
- owner => $owner,
- group => $group,
- mode => $mode,
- source => $source,
- content => $content,
- notify => Service['httpd'],
- # For the default parent directory
- require => Package['httpd'],
- }
-}
-
View
22 modules/apache-httpd/manifests/service/ssl.pp
@@ -1,22 +0,0 @@
-# Apache httpd web server service ssl class, inherited from the base class.
-#
-# We add the mod_ssl package with a stipped-down configuration.
-#
-class apache-httpd::service::ssl inherits apache-httpd::service::base {
-
- # Main package and service changes
- package { 'mod_ssl': ensure => installed }
- Service['httpd'] {
- require +> Package['mod_ssl'],
- subscribe +> Package['mod_ssl'],
- }
-
- # We disable everything in the file except loading the module
- # To listen on 443, the directive is required in an apache-httpd::file
- apache-httpd::file { 'ssl.conf':
- require => Package['mod_ssl'],
- content => template('apache-httpd/conf.d/ssl.conf'),
- }
-
-}
-
View
4 modules/apache-httpd/tests/file.pp
@@ -1,4 +0,0 @@
-apache-httpd::file { 'trace.inc':
- source => 'puppet:///modules/apache-httpd/trace.inc',
-}
-
View
7 modules/apache-httpd/tests/init.pp
@@ -1,7 +0,0 @@
-apache-httpd { 'worker':
- ssl => true,
- modules => [],
- welcome => false,
- serversignature => 'Off',
-}
-
View
6 modules/apache_httpd/ChangeLog
@@ -0,0 +1,6 @@
+2012-03-07 - 0.3.0
+* Rename from apache-httpd to apache_httpd to conform with puppetlabs docs.
+* Update tests to cover more cases.
+* Include LICENSE since the module will be distributed individually.
+* Update included documentation details.
+
View
14 modules/apache_httpd/LICENSE
@@ -0,0 +1,14 @@
+Copyright (C) 2011 Matthias Saou
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
View
9 modules/apache_httpd/Modulefile
@@ -0,0 +1,9 @@
+name 'thias-apache_httpd'
+version '0.3.0'
+source 'git://github.com/thias/puppet-modules/modules/apache_httpd'
+author 'Matthias Saou'
+license 'Apache 2.0'
+summary 'Apache HTTP Daemon installation and configuration'
+description "Install and enable the Apache httpd web server and manage its
+ configuration with snippets."
+project_page 'http://glee.thias.es/puppet'
View
19 modules/apache-httpd/README → modules/apache_httpd/README
@@ -1,15 +1,6 @@
-= Summary
-
-Summary:: Apache httpd server module
-Author:: Matthias Saou <matthias@saou.eu>
-License:: Apache License 2.0
-Updated:: August 2011
-
-= Sample Usage
-
Sripped down instance running as the git user for the cgit cgi :
- apache-httpd { 'worker':
+ apache_httpd { 'worker':
modules => [ 'mime', 'setenvif', 'alias', 'proxy', 'cgi' ],
keepalive => 'On',
user => 'git',
@@ -18,7 +9,7 @@ Sripped down instance running as the git user for the cgit cgi :
Complete instance with https and a typical and ready for php :
- apache-httpd { 'prefork':
+ apache_httpd { 'prefork':
ssl => true,
modules => [
'auth_basic',
@@ -37,17 +28,17 @@ Complete instance with https and a typical and ready for php :
Example entry you probably want to add to your site.pp to change some of the defaults globally :
- Apache-Httpd {
+ Apache_httpd {
extendedstatus => 'On',
serveradmin => 'root@mydomain.example.com',
}
Configuration snippets can be added from files or templates and will automatically reload httpd when changed :
- apache-httpd::file { 'www.example.com.conf':
+ apache_httpd::file { 'www.example.com.conf':
source => 'puppet:///files/mygreatcustomfiles/www.example.com.conf',
}
- apache-httpd::file { 'global-alias.conf':
+ apache_httpd::file { 'global-alias.conf':
content => 'Alias /whatever /var/www/whatever',
}
View
0  modules/apache-httpd/files/proxy_ajp.conf → modules/apache_httpd/files/proxy_ajp.conf
File renamed without changes
View
0  ...es/apache-httpd/files/proxy_ajp.conf.orig → ...es/apache_httpd/files/proxy_ajp.conf.orig
File renamed without changes
View
0  modules/apache-httpd/files/trace.inc → modules/apache_httpd/files/trace.inc
File renamed without changes
View
0  modules/apache-httpd/files/welcome.conf → modules/apache_httpd/files/welcome.conf
File renamed without changes
View
50 modules/apache_httpd/manifests/file.pp
@@ -0,0 +1,50 @@
+# Define: apache_httpd::file
+#
+# Apache httpd server configuration file definition. Any new, removed or
+# changed files will automatically reload the httpd server.
+# Note that for major changes, such as address binds, SSL certificate changes,
+# etc. it might still be needed to force a full restart of the service.
+#
+# Parameters:
+# $source:
+# The puppet file type 'source' value where to take the configuration file
+# from. Mutually exclusive with $content. Default: none.
+# $content:
+# The puppet file type 'content' value for the configuration file's content.
+# Mutually exclusive with $source. Default: none.
+# $ensure:
+# Whether the file should be 'present' or 'absent'. Defaults to 'present'.
+#
+# Sample Usage :
+# apache_httpd::file { 'www.example.com.conf':
+# source => 'puppet:///files/apache_httpd/www.example.com.conf',
+# }
+# apache_httpd::file { 'foo.conf':
+# content => "LoadModule foo_module modules/foo.so\nFooDirective\n",
+# }
+# apache_httpd::file { 'mod_unwanted.conf':
+# ensure => absent,
+# }
+#
+define apache_httpd::file (
+ $confd = '/etc/httpd/conf.d',
+ $owner = 'root',
+ $group = 'root',
+ $mode = '0644',
+ $source = undef,
+ $content = undef,
+ $ensure = undef
+) {
+ file { "${confd}/${title}":
+ ensure => $ensure,
+ owner => $owner,
+ group => $group,
+ mode => $mode,
+ source => $source,
+ content => $content,
+ notify => Service['httpd'],
+ # For the default parent directory
+ require => Package['httpd'],
+ }
+}
+
View
41 modules/apache-httpd/manifests/init.pp → modules/apache_httpd/manifests/init.pp
@@ -1,4 +1,6 @@
-# Apache httpd web server definition.
+# Class: apache_httpd
+#
+# Apache httpd web server main definition.
#
# The title must be 'prefork' (RHEL default) or 'worker'. The defaults are
# as close as possible to the original RHEL defaults. The configuration files
@@ -8,12 +10,15 @@
# the original testing page work, but passing an array of module names as the
# 'modules' parameter resets them to only the 'log' module.
#
+# Parameters:
+# Too many to list here. See the module's init.pp file.
+#
# Sample Usage :
-# apache-httpd { 'prefork':
-# modules => [ 'mime' ],
-# }
+# apache_httpd { 'prefork':
+# modules => [ 'mime' ],
+# }
#
-define apache-httpd (
+define apache_httpd (
$ssl = false,
# Options for the sysconfig file
$options = false,
@@ -71,36 +76,36 @@
# Our own pre-configured file (disable nearly everything)
file { '/etc/httpd/conf/httpd.conf':
require => Package['httpd'],
- content => template('apache-httpd/conf/httpd.conf.erb'),
+ content => template('apache_httpd/conf/httpd.conf.erb'),
notify => Service['httpd'],
}
# On RHEL5, this gets in the way... it should be configured from elsewhere
if $::operatingsystem == 'RedHat' and $::operatingsystemrelease < 6 {
# We can't 'ensure => absent' or it would reappear with updates
- apache-httpd::file { 'proxy_ajp.conf':
- source => 'puppet:///modules/apache-httpd/proxy_ajp.conf',
+ apache_httpd::file { 'proxy_ajp.conf':
+ source => 'puppet:///modules/apache_httpd/proxy_ajp.conf',
}
} else {
# Just in case we have updated from RHEL5
- apache-httpd::file { 'proxy_ajp.conf':
+ apache_httpd::file { 'proxy_ajp.conf':
ensure => absent,
}
}
# Install extra file to disable TRACE and TRACK methods
- apache-httpd::file { 'trace.inc':
- source => 'puppet:///modules/apache-httpd/trace.inc',
+ apache_httpd::file { 'trace.inc':
+ source => 'puppet:///modules/apache_httpd/trace.inc',
}
# Change the original welcome condition, since our default has the index
# return 404 instead of 403.
if $welcome {
- apache-httpd::file { 'welcome.conf':
- source => 'puppet:///modules/apache-httpd/welcome.conf',
+ apache_httpd::file { 'welcome.conf':
+ source => 'puppet:///modules/apache_httpd/welcome.conf',
}
} else {
- apache-httpd::file { 'welcome.conf':
+ apache_httpd::file { 'welcome.conf':
# Don't "absent" since the file comes back when httpd is updated
content => "# Default welcome page disabled\n",
}
@@ -109,21 +114,21 @@
# Tweak the sysconfig file
file { '/etc/sysconfig/httpd':
require => Package['httpd'],
- content => template('apache-httpd/etc/sysconfig.erb'),
+ content => template('apache_httpd/etc/sysconfig.erb'),
notify => Service['httpd'],
}
# Install the custom logrotate file
file { '/etc/logrotate.d/httpd':
require => Package['httpd'],
- content => template('apache-httpd/etc/logrotate.erb'),
+ content => template('apache_httpd/etc/logrotate.erb'),
}
# We use classes with inheritence in order to perform service overrides
if $ssl {
- include apache-httpd::service::ssl
+ include apache_httpd::service::ssl
} else {
- include apache-httpd::service::base
+ include apache_httpd::service::base
}
}
View
8 ...es/apache-httpd/manifests/service/base.pp → ...es/apache_httpd/manifests/service/base.pp
@@ -1,10 +1,12 @@
+# Class: apache_httpd::service::base
+#
# Apache httpd web server service base class.
# This class is not meant to be used on its own.
# It exists only because parametrized classes cannot be inherited reliably
-# (as of 2.6.8), so we have the main apache-httpd definition wrapping around
-# non-parametrized classes with inheritence.
+# (as of 2.6.8), so we have the main apache_httpd definition wrapping around
+# small non-parametrized classes with inheritence.
#
-class apache-httpd::service::base {
+class apache_httpd::service::base {
# Main service, modified in inherited classes
service { 'httpd':
View
26 modules/apache_httpd/manifests/service/ssl.pp
@@ -0,0 +1,26 @@
+# Class: apache_httpd::service::ssl
+#
+# Apache httpd web server service ssl class, inherited from the base class.
+#
+# We add the mod_ssl package with a stipped-down configuration. This class is
+# not meant to be included on its own, but from the main class when $ssl is
+# true.
+#
+class apache_httpd::service::ssl inherits apache_httpd::service::base {
+
+ # Main package and service changes
+ package { 'mod_ssl': ensure => installed }
+ Service['httpd'] {
+ require +> Package['mod_ssl'],
+ subscribe +> Package['mod_ssl'],
+ }
+
+ # We disable everything in the file except loading the module
+ # To listen on 443, the directive is required in an apache_httpd::file
+ apache_httpd::file { 'ssl.conf':
+ require => Package['mod_ssl'],
+ content => template('apache_httpd/conf.d/ssl.conf'),
+ }
+
+}
+
View
0  ...es/apache-httpd/templates/conf.d/ssl.conf → ...es/apache_httpd/templates/conf.d/ssl.conf
File renamed without changes
View
0  ...ache-httpd/templates/conf.d/ssl.conf.orig → ...ache_httpd/templates/conf.d/ssl.conf.orig
File renamed without changes
View
0  ...pache-httpd/templates/conf/httpd.conf.erb → ...pache_httpd/templates/conf/httpd.conf.erb
File renamed without changes
View
0  ...ache-httpd/templates/conf/httpd.conf.orig → ...ache_httpd/templates/conf/httpd.conf.orig
File renamed without changes
View
0  .../apache-httpd/templates/etc/logrotate.erb → .../apache_httpd/templates/etc/logrotate.erb
File renamed without changes
View
0  .../apache-httpd/templates/etc/sysconfig.erb → .../apache_httpd/templates/etc/sysconfig.erb
File renamed without changes
View
9 modules/apache_httpd/tests/file.pp
@@ -0,0 +1,9 @@
+# We need the package and service for the file definition to work
+import 'init.pp'
+apache_httpd::file { 'foo.conf':
+ source => 'puppet:///modules/apache_httpd/welcome.conf',
+}
+apache_httpd::file { 'foo-ssl.conf':
+ content => template('apache_httpd/conf.d/ssl.conf'),
+}
+
View
11 modules/apache_httpd/tests/init.pp
@@ -0,0 +1,11 @@
+Apache_httpd {
+ extendedstatus => 'On',
+ serveradmin => 'root@mydomain.example.com',
+}
+apache_httpd { 'worker':
+ ssl => true,
+ modules => [],
+ welcome => false,
+ serversignature => 'Off',
+}
+
Please sign in to comment.
Something went wrong with that request. Please try again.