forked from puppetlabs/puppetlabs-apache
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Turnbull
committed
Sep 1, 2010
0 parents
commit 35721a3
Showing
58 changed files
with
1,023 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name 'puppetlabs-apache' | ||
version '0.0.3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Configuration file for the httpd service. | ||
|
||
# | ||
# The default processing model (MPM) is the process-based | ||
# 'prefork' model. A thread-based model, 'worker', is also | ||
# available, but does not work with some modules (such as PHP). | ||
# The service must be stopped before changing this variable. | ||
# | ||
#HTTPD=/usr/sbin/httpd.worker | ||
|
||
# | ||
# To pass additional options (for instance, -D definitions) to the | ||
# httpd binary at startup, set OPTIONS here. | ||
# | ||
#OPTIONS= | ||
#OPTIONS=-DDOWN | ||
|
||
# | ||
# By default, the httpd process is started in the C locale; to | ||
# change the locale in which the server runs, the HTTPD_LANG | ||
# variable can be set. | ||
# | ||
#HTTPD_LANG=C | ||
export SHORTHOST=`hostname -s` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
# Test vhost | ||
# | ||
NameVirtualHost *:80 | ||
<VirtualHost *:80> | ||
ServerName testvhost | ||
DocumentRoot /tmp/testvhost | ||
<Directory /tmp/testvhost> | ||
Options Indexes FollowSymLinks MultiViews | ||
AllowOverride None | ||
Order allow,deny | ||
allow from all | ||
</Directory> | ||
ErrorLog /var/log/apache2/error.log | ||
LogLevel warn | ||
CustomLog /var/log/apache2/access.log combined | ||
ServerSignature On | ||
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Puppet::Type.type(:a2mod).provide(:a2mod) do | ||
desc "Manage Apache 2 modules on Debian and Ubuntu" | ||
|
||
commands :encmd => "a2enmod" | ||
commands :discmd => "a2dismod" | ||
|
||
defaultfor :operatingsystem => [:debian, :ubuntu] | ||
|
||
def create | ||
encmd resource[:name] | ||
end | ||
|
||
def destroy | ||
discmd resource[:name] | ||
end | ||
|
||
def exists? | ||
mod= "/etc/apache2/mods-enabled/" + resource[:name] + ".load" | ||
File.exists?(mod) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Puppet::Type.newtype(:a2mod) do | ||
@doc = "Manage Apache 2 modules on Debian and Ubuntu" | ||
|
||
ensurable | ||
|
||
newparam(:name) do | ||
desc "The name of the module to be managed" | ||
|
||
isnamevar | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Class: apache::dev | ||
# | ||
# This class installs Apache development libraries | ||
# | ||
# Parameters: | ||
# | ||
# Actions: | ||
# - Install Apache development libraries | ||
# | ||
# Requires: | ||
# | ||
# Sample Usage: | ||
# | ||
class apache::dev { | ||
include apache::params | ||
|
||
package{$apache::params::apache_dev: ensure => installed} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Class: apache | ||
# | ||
# This class installs Apache | ||
# | ||
# Parameters: | ||
# | ||
# Actions: | ||
# - Install Apache | ||
# - Manage Apache service | ||
# | ||
# Requires: | ||
# | ||
# Sample Usage: | ||
# | ||
class apache { | ||
include apache::params | ||
package { 'httpd': | ||
name => $apache::params::apache_name, | ||
ensure => present, | ||
} | ||
service { 'httpd': | ||
name => $apache::params::apache_name, | ||
ensure => running, | ||
enable => true, | ||
subscribe => Package['httpd'], | ||
} | ||
# | ||
# May want to purge all none realize modules using the resources resource type. | ||
# | ||
A2mod { require => Package['httpd'], notify => Service['httpd']} | ||
@a2mod { | ||
'rewrite' : ensure => present; | ||
'headers' : ensure => present; | ||
'expires' : ensure => present; | ||
} | ||
|
||
|
||
file { $apache::params::vdir: | ||
ensure => directory, | ||
recurse => true, | ||
purge => true, | ||
notify => Service['httpd'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Class: apache::params | ||
# | ||
# This class manages Apache parameters | ||
# | ||
# Parameters: | ||
# - The $user that Apache runs as | ||
# - The $group that Apache runs as | ||
# - The $apache_name is the name of the package and service on the relevant distribution | ||
# - The $php_package is the name of the package that provided PHP | ||
# - The $ssl_package is the name of the Apache SSL package | ||
# - The $apache_dev is the name of the Apache development libraries package | ||
# | ||
# Actions: | ||
# | ||
# Requires: | ||
# | ||
# Sample Usage: | ||
# | ||
class apache::params { | ||
|
||
$user = 'www-data' | ||
$group = 'www-data' | ||
|
||
case $operatingsystem { | ||
'centos', 'redhat', 'fedora': { | ||
$apache_name = 'httpd' | ||
$php_package = 'php' | ||
$ssl_package = 'mod_ssl' | ||
$apache_dev = 'httpd-devel' | ||
$vdir = '/etc/httpd/conf.d/' | ||
} | ||
'ubuntu', 'debian': { | ||
$apache_name = 'apache2' | ||
$php_package = 'libapache2-mod-php5' | ||
$ssl_package = 'apache-ssl' | ||
$apache_dev = [ 'libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev' ] | ||
$vdir = '/etc/apache2/sites-enabled/' | ||
} | ||
default: { | ||
$apache_name = 'apache2' | ||
$php_package = 'libapache2-mod-php5' | ||
$ssl_package = 'apache-ssl' | ||
$apache_dev = 'apache-dev' | ||
$vdir = '/etc/apache2/sites-enabled/' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Class: apache::php | ||
# | ||
# This class installs PHP for Apache | ||
# | ||
# Parameters: | ||
# - $php_package | ||
# | ||
# Actions: | ||
# - Install Apache PHP package | ||
# | ||
# Requires: | ||
# | ||
# Sample Usage: | ||
# | ||
class apache::php { | ||
|
||
include apache::params | ||
|
||
package { $apache::params::php_package: | ||
ensure => present, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Class: apache::ssl | ||
# | ||
# This class installs Apache SSL capabilities | ||
# | ||
# Parameters: | ||
# - The $ssl_package name from the apache::params class | ||
# | ||
# Actions: | ||
# - Install Apache SSL capabilities | ||
# | ||
# Requires: | ||
# | ||
# Sample Usage: | ||
# | ||
class apache::ssl { | ||
|
||
include apache | ||
|
||
case $operatingsystem { | ||
'centos', 'fedora', 'redhat': { | ||
package { $apache::params::ssl_package: | ||
require => Package['httpd'], | ||
} | ||
} | ||
'ubuntu', 'debian': { | ||
a2mod { "ssl": ensure => present, } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Definition: apache::vhost | ||
# | ||
# This class installs Apache Virtual Hosts | ||
# | ||
# Parameters: | ||
# - The $port to configure the host on | ||
# - The $docroot provides the DocumentationRoot variable | ||
# - The $ssl option is set true or false to enable SSL for this Virtual Host | ||
# - The $template option specifies whether to use the default template or override | ||
# - The $priority of the site | ||
# - The $serveraliases of the site | ||
# | ||
# Actions: | ||
# - Install Apache Virtual Hosts | ||
# | ||
# Requires: | ||
# - The apache class | ||
# | ||
# Sample Usage: | ||
# apache::vhost { 'site.name.fqdn': | ||
# priority => '20', | ||
# port => '80', | ||
# docroot => '/path/to/docroot', | ||
# } | ||
# | ||
define apache::vhost( $port, $docroot, $ssl=true, $template='apache/vhost-default.conf.erb', $priority, $serveraliases = '' ) { | ||
|
||
include apache | ||
|
||
file {"${apache::params::vdir}/${priority}-${name}": | ||
content => template($template), | ||
owner => 'root', | ||
group => 'root', | ||
mode => '777', | ||
require => Package['httpd'], | ||
notify => Service['httpd'], | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name 'puppetlabs-apache' | ||
version '0.0.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Configuration file for the httpd service. | ||
|
||
# | ||
# The default processing model (MPM) is the process-based | ||
# 'prefork' model. A thread-based model, 'worker', is also | ||
# available, but does not work with some modules (such as PHP). | ||
# The service must be stopped before changing this variable. | ||
# | ||
#HTTPD=/usr/sbin/httpd.worker | ||
|
||
# | ||
# To pass additional options (for instance, -D definitions) to the | ||
# httpd binary at startup, set OPTIONS here. | ||
# | ||
#OPTIONS= | ||
#OPTIONS=-DDOWN | ||
|
||
# | ||
# By default, the httpd process is started in the C locale; to | ||
# change the locale in which the server runs, the HTTPD_LANG | ||
# variable can be set. | ||
# | ||
#HTTPD_LANG=C | ||
export SHORTHOST=`hostname -s` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
# Test vhost | ||
# | ||
NameVirtualHost *:80 | ||
<VirtualHost *:80> | ||
ServerName testvhost | ||
DocumentRoot /tmp/testvhost | ||
<Directory /tmp/testvhost> | ||
Options Indexes FollowSymLinks MultiViews | ||
AllowOverride None | ||
Order allow,deny | ||
allow from all | ||
</Directory> | ||
ErrorLog /var/log/apache2/error.log | ||
LogLevel warn | ||
CustomLog /var/log/apache2/access.log combined | ||
ServerSignature On | ||
</VirtualHost> |
21 changes: 21 additions & 0 deletions
21
pkg/puppetlabs-apache-0.0.2/lib/puppet/provider/a2mod/a2mod.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Puppet::Type.type(:a2mod).provide(:a2mod) do | ||
desc "Manage Apache 2 modules on Debian and Ubuntu" | ||
|
||
commands :encmd => "a2enmod" | ||
commands :discmd => "a2dismod" | ||
|
||
defaultfor :operatingsystem => [:debian, :ubuntu] | ||
|
||
def create | ||
encmd resource[:name] | ||
end | ||
|
||
def destroy | ||
discmd resource[:name] | ||
end | ||
|
||
def exists? | ||
mod= "/etc/apache2/mods-enabled/" + resource[:name] + ".load" | ||
File.exists?(mod) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Puppet::Type.newtype(:a2mod) do | ||
@doc = "Manage Apache 2 modules on Debian and Ubuntu" | ||
|
||
ensurable | ||
|
||
newparam(:name) do | ||
desc "The name of the module to be managed" | ||
|
||
isnamevar | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Class: apache::dev | ||
# | ||
# This class installs Apache development libraries | ||
# | ||
# Parameters: | ||
# | ||
# Actions: | ||
# - Install Apache development libraries | ||
# | ||
# Requires: | ||
# | ||
# Sample Usage: | ||
# | ||
class apache::dev { | ||
include apache::params | ||
|
||
package{$apache::params::apache_dev: ensure => installed} | ||
} |
Oops, something went wrong.