Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 42dafe07468261675bc4eda38761db2fe1ccf9cc Brian Donovan committed Mar 12, 2008
13 LICENSE
@@ -0,0 +1,13 @@
+Copyright 2007 Wesabe, Inc.
+
+ 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.
112 README
@@ -0,0 +1,112 @@
+# Apache2 Recipe #
+apache2 -- v0.4 by Sam Quigley <sq@wesabe.com>
+
+Basic module for configuring apache via puppet. Debian/Ubuntu-specific at
+the moment, but patches are welcome.
+
+Based in part on code by Tim Stoop <tim.stoop@gmail.com> and
+David Schmitt <david@schmitt.edv-bus.at>
+
+## Configuration ##
+
+This module installs apache2 from packages and promptly overwrites the default
+configuration with one that does nothing other than include various
+directories:
+
+* /etc/apache2/mods-enabled/
+* /etc/apache2/conf.d
+* /etc/apache2/sites-enabled/
+
+Defines are provided to allow recipes and child classes to interact with these
+directories -- see below.
+
+An additional class, `apache2_debian`, is provided which attempts to mimic
+the default configuration of a freshly-installed debian apache2 package.
+
+A single global configuration variable is available, `$apache2_mpm`, which
+controls which of the mpm packages are installed. Its possible values are:
+
+* 'event': Use the event driven model (experimental)
+* 'prefork': Traditional
+* 'worker': High speed threaded model
+
+'worker' is the default.
+
+See the apache2::debian and apache2::basic subclasses for examples of how to
+use and configure this class. Note that these do *NOT* install site
+definitions -- so simply including them in a node definition won't work...
+
+### `apache2::config` ###
+
+`apache2::config` installs a configuration snippet in conf.d. Takes the following options:
+
+* `name`: the name of the config snipppet [namevar]
+* `ensure`: typically set to "present" or "absent", but any value legal
+for a file resource can be used. Defaults to "present"
+* `content`: set this to the text of the snippet -- eg, through
+template(). Defaults to `template("apache2/$name.conf.erb")`, which is
+unlikely to be what you want.
+* `order`: specifies the load order for this config snippet. the snippet
+will end up in `/etc/apache2/conf.d/$order-$name.conf`, and apache will load
+files in alphanumeric order. Defaults to "500"
+* `require`: if set, this will require that a package of the given name exists
+before evaluating the rest of the config definition. It does not currently
+remove the package, even if ensure is set to absent.
+
+### `apache2::module` ###
+
+`apache2::module` enables an apache module. It does *NOT* currently install
+one for you, except through the "require" argument -- see below.
+Options are:
+
+* `name`: name of the module. A file with the name
+`mods-available/$name.load` is expected to exist in the apache2 directory
+* `ensure`: can be "present" or "absent"
+* `require`: if set, this will require that a package of the given name exists
+before evaluating the rest of the module definition. It does not currently
+remove the package, even if ensure is set to absent.
+
+### `apache2::site` ###
+
+`apache2::site` enables an apache site. Options are:
+
+* `name`: name of the site. A file with the name
+`sites-available/$name` is expected to exist in the apache2 directory
+* `ensure`: can be "present", "installed", or "absent"
+* `require`: if set, this will require that a package of the given name exists
+before evaluating the rest of the site definition. It does not currently
+remove the package, even if ensure is set to absent.
+* `content`: set this to the text of the site definition -- eg, through
+template(). If unset, the module will simply ensure that a file named
+"/etc/apache2/sites-available/$name" exists
+
+## Example ##
+
+See the code for the apache2_debian subclass for an example of how to use
+this module.
+
+## To Do ##
+
+* apache2::{module,config,site} should really be native types.
+* The configuration of apache2::basic is essentially arbitrary, based on
+what I needed to override at the moment. Some logic would probably be
+helpful.
+
+## Changes ##
+
+* stop explicitly importing stuff from manifests/classes; rely on autoload instead
+* add `site_include` definition, similar to `site`
+* add content property to site definition, similar to config
+* allow ensure=>installed for sites -- required moving site installation code
+to a new definition.
+* added apache2::debian and apache2::basic subclasses
+* added `config` definition, similar to the existing `site` and `module` defs,
+which will include given config snippets
+* Removed port configuration (via /etc/apache2/ports.conf) -- Listen
+directives make more sense in the individual site definitions, at least for
+SSL, load-balanced, and proxied environments...
+* Removed DavidS' nagios and munin stuff; will probably re-add later.
+* Removed the `no_default_site` subclass and made it the default behavior. No
+one _really_ wants to serve their distro's default page...
+* Removed the `apache2_ssl business` -- with Listen configured in the site
+defs themselves, it's not really necessary
@@ -0,0 +1,14 @@
+# apache2.conf -- version for puppet-controlled installations
+#
+# this config file merely includes other files; all the truly important stuff
+# is configured in one of these directories.
+
+# Include module configuration:
+Include /etc/apache2/mods-enabled/*.load
+Include /etc/apache2/mods-enabled/*.conf
+
+# Include generic snippets of statements
+Include /etc/apache2/conf.d/*.conf
+
+# Include the virtual host configurations:
+Include /etc/apache2/sites-enabled/
@@ -0,0 +1,34 @@
+# apache2/manifests/classes/apache2_basic.pp
+# by Sam Quigley <sq@wesabe.com>
+
+# implements a basic, no-frills apache.
+
+class apache2::basic inherits apache2 {
+ apache2::config { "base":
+ order => "000",
+ ensure => present,
+ content => template("apache2/base.conf.erb"),
+ }
+ apache2::module { "dir": ensure => present } # provides DirectoryIndex
+
+ apache2::config { "mpm":
+ order => "010",
+ ensure => present,
+ content => template("apache2/mpm-$real_apache2_mpm.conf.erb"),
+ }
+
+ apache2::config { "mime":
+ order => "020",
+ ensure => present,
+ content => template("apache2/mime-minimal.conf.erb"),
+ }
+ apache2::module { "mime": ensure => present }
+
+ apache2::config { "browser_fixes":
+ order => "030",
+ ensure => present,
+ content => template("apache2/browser_fixes.conf.erb"),
+ }
+ apache2::module { "setenvif": ensure => present }
+
+}
@@ -0,0 +1,19 @@
+# apache2/manifests/classes/apache2_debian.pp
+# by Sam Quigley <sq@wesabe.com>
+
+# this class attempts to mimic the default configuration of the debian
+# apache2 package
+
+class apache2::debian inherits apache2 {
+ apache2::config { "debian.conf":
+ order => "000",
+ ensure => present,
+ }
+
+ apache2::module { ["alias", "auth_basic", "authn_file",
+ "authz_default", "authz_groupfile", "authz_host",
+ "authz_user", "autoindex", "cgid", "dir", "env", "mime",
+ "negotiation", "setenvif", "status"]:
+ ensure=> present,
+ }
+}
Oops, something went wrong.

0 comments on commit 42dafe0

Please sign in to comment.