Initial commit
This commit is contained in:
commit
35721a3f35
2
Modulefile
Normal file
2
Modulefile
Normal file
@ -0,0 +1,2 @@
|
||||
name 'puppetlabs-apache'
|
||||
version '0.0.3'
|
24
files/httpd
Normal file
24
files/httpd
Normal file
@ -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`
|
18
files/test.vhost
Normal file
18
files/test.vhost
Normal file
@ -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
lib/puppet/provider/a2mod/a2mod.rb
Normal file
21
lib/puppet/provider/a2mod/a2mod.rb
Normal file
@ -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
|
12
lib/puppet/type/a2mod.rb
Normal file
12
lib/puppet/type/a2mod.rb
Normal file
@ -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
|
18
manifests/dev.pp
Normal file
18
manifests/dev.pp
Normal file
@ -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}
|
||||
}
|
44
manifests/init.pp
Normal file
44
manifests/init.pp
Normal file
@ -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'],
|
||||
}
|
||||
}
|
47
manifests/params.pp
Normal file
47
manifests/params.pp
Normal file
@ -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/'
|
||||
}
|
||||
}
|
||||
}
|
22
manifests/php.pp
Normal file
22
manifests/php.pp
Normal file
@ -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,
|
||||
}
|
||||
}
|
29
manifests/ssl.pp
Normal file
29
manifests/ssl.pp
Normal file
@ -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, }
|
||||
}
|
||||
}
|
||||
}
|
38
manifests/vhost.pp
Normal file
38
manifests/vhost.pp
Normal file
@ -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'],
|
||||
}
|
||||
}
|
BIN
pkg/puppetlabs-apache-0.0.2.tar.gz
Normal file
BIN
pkg/puppetlabs-apache-0.0.2.tar.gz
Normal file
Binary file not shown.
2
pkg/puppetlabs-apache-0.0.2/Modulefile
Normal file
2
pkg/puppetlabs-apache-0.0.2/Modulefile
Normal file
@ -0,0 +1,2 @@
|
||||
name 'puppetlabs-apache'
|
||||
version '0.0.2'
|
24
pkg/puppetlabs-apache-0.0.2/files/httpd
Normal file
24
pkg/puppetlabs-apache-0.0.2/files/httpd
Normal file
@ -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`
|
18
pkg/puppetlabs-apache-0.0.2/files/test.vhost
Normal file
18
pkg/puppetlabs-apache-0.0.2/files/test.vhost
Normal file
@ -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>
|
@ -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
|
12
pkg/puppetlabs-apache-0.0.2/lib/puppet/type/a2mod.rb
Normal file
12
pkg/puppetlabs-apache-0.0.2/lib/puppet/type/a2mod.rb
Normal file
@ -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
|
18
pkg/puppetlabs-apache-0.0.2/manifests/dev.pp
Normal file
18
pkg/puppetlabs-apache-0.0.2/manifests/dev.pp
Normal file
@ -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}
|
||||
}
|
47
pkg/puppetlabs-apache-0.0.2/manifests/init.pp
Normal file
47
pkg/puppetlabs-apache-0.0.2/manifests/init.pp
Normal file
@ -0,0 +1,47 @@
|
||||
# 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 resource type is broken. Look into fixing it and moving it into apache.
|
||||
#
|
||||
A2mod { require => Package['httpd'], notify => Service['httpd']}
|
||||
@a2mod {
|
||||
'rewrite' : ensure => present;
|
||||
'headers' : ensure => present;
|
||||
'expires' : ensure => present;
|
||||
}
|
||||
$vdir = $operatingsystem? {
|
||||
'ubuntu' => '/etc/apache2/sites-enabled/',
|
||||
default => '/etc/httpd/conf.d',
|
||||
}
|
||||
file { $vdir:
|
||||
ensure => directory,
|
||||
recurse => true,
|
||||
purge => true,
|
||||
notify => Service['httpd'],
|
||||
}
|
||||
}
|
44
pkg/puppetlabs-apache-0.0.2/manifests/params.pp
Normal file
44
pkg/puppetlabs-apache-0.0.2/manifests/params.pp
Normal file
@ -0,0 +1,44 @@
|
||||
# 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'
|
||||
}
|
||||
'ubuntu', 'debian': {
|
||||
$apache_name = 'apache2'
|
||||
$php_package = 'libapache2-mod-php5'
|
||||
$ssl_package = 'apache-ssl'
|
||||
$apache_dev = [ 'libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev' ]
|
||||
}
|
||||
default: {
|
||||
$apache_name = 'apache2'
|
||||
$php_package = 'libapache2-mod-php5'
|
||||
$ssl_package = 'apache-ssl'
|
||||
$apache_dev = 'apache-dev'
|
||||
}
|
||||
}
|
||||
}
|
22
pkg/puppetlabs-apache-0.0.2/manifests/php.pp
Normal file
22
pkg/puppetlabs-apache-0.0.2/manifests/php.pp
Normal file
@ -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,
|
||||
}
|
||||
}
|
29
pkg/puppetlabs-apache-0.0.2/manifests/ssl.pp
Normal file
29
pkg/puppetlabs-apache-0.0.2/manifests/ssl.pp
Normal file
@ -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, }
|
||||
}
|
||||
}
|
||||
}
|
43
pkg/puppetlabs-apache-0.0.2/manifests/vhost.pp
Normal file
43
pkg/puppetlabs-apache-0.0.2/manifests/vhost.pp
Normal file
@ -0,0 +1,43 @@
|
||||
# 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
|
||||
|
||||
$vdir = $operatingsystem? {
|
||||
/(ubuntu|debian)/ => '/etc/apache2/sites-enabled/',
|
||||
default => '/etc/httpd/conf.d',
|
||||
}
|
||||
|
||||
file {"${vdir}/${priority}-${name}":
|
||||
content => template($template),
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '777',
|
||||
require => Package['httpd'],
|
||||
notify => Service['httpd'],
|
||||
}
|
||||
}
|
51
pkg/puppetlabs-apache-0.0.2/metadata.json
Normal file
51
pkg/puppetlabs-apache-0.0.2/metadata.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"types": [
|
||||
{
|
||||
"parameters": [
|
||||
{
|
||||
"name": "name",
|
||||
"doc": "The name of the module to be managed"
|
||||
}
|
||||
],
|
||||
"properties": [
|
||||
{
|
||||
"name": "ensure",
|
||||
"doc": "The basic property that the resource should be in. Valid values are ``present``, ``absent``."
|
||||
}
|
||||
],
|
||||
"name": "a2mod",
|
||||
"providers": [
|
||||
{
|
||||
"name": "a2mod",
|
||||
"doc": "Manage Apache 2 modules on Debian and Ubuntu Required binaries: ``a2enmod``, ``a2dismod``. Default for ``operatingsystem`` == ``debianubuntu``. "
|
||||
}
|
||||
],
|
||||
"doc": "Manage Apache 2 modules on Debian and Ubuntu"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"checksums": {
|
||||
"manifests/params.pp": "f137ab035e6cd5bdbbd50beeac4c68b0",
|
||||
"tests/ssl.pp": "191912535199531fd631f911c6329e56",
|
||||
"tests/vhost.pp": "1b91e03c8ef89a7ecb6793831ac18399",
|
||||
"manifests/php.pp": "8a5ca4035b1c22892923f3fde55e3d5e",
|
||||
"files/httpd": "295f5e924afe6f752d29327e73fe6d0a",
|
||||
"tests/php.pp": "ce7bb9eef69d32b42a32ce32d9653625",
|
||||
"lib/puppet/provider/a2mod/a2mod.rb": "18c5bb180b75a2375e95e07f88a94257",
|
||||
"files/test.vhost": "0602022c19a7b6b289f218c7b93c1aea",
|
||||
"manifests/ssl.pp": "11ed1861298c72cca3a706480bb0b67c",
|
||||
"manifests/dev.pp": "bc54a5af648cb04b7b3bb0e3f7be6543",
|
||||
"manifests/vhost.pp": "b43a4d6efb4563341efe8092677aac6f",
|
||||
"tests/init.pp": "4eac4a7ef68499854c54a78879e25535",
|
||||
"lib/puppet/type/a2mod.rb": "0e1b4843431413a10320ac1f6a055d15",
|
||||
"tests/apache.pp": "4eac4a7ef68499854c54a78879e25535",
|
||||
"tests/dev.pp": "4cf15c1fecea3ca86009f182b402c7ab",
|
||||
"templates/vhost-default.conf.erb": "9055aed946e1111c30ab81fedac2c8b0",
|
||||
"manifests/init.pp": "168dfe06fb9ad8d67a2effeea4477f57",
|
||||
"Modulefile": "86f48ebf97e079cf0dc395881d87ecef"
|
||||
},
|
||||
"version": "0.0.2",
|
||||
"name": "puppetlabs-apache"
|
||||
}
|
20
pkg/puppetlabs-apache-0.0.2/templates/vhost-default.conf.erb
Normal file
20
pkg/puppetlabs-apache-0.0.2/templates/vhost-default.conf.erb
Normal file
@ -0,0 +1,20 @@
|
||||
NameVirtualHost *:<%= port %>
|
||||
<VirtualHost *:<%= port %>>
|
||||
ServerName <%= name %>
|
||||
<%if serveraliases.is_a? Array -%>
|
||||
<% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
|
||||
<% elsif serveraliases != '' -%>
|
||||
<%= " ServerAlias #{serveraliases}" -%>
|
||||
<% end -%>
|
||||
DocumentRoot <%= docroot %>
|
||||
<Directory <%= docroot %>>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
ErrorLog /var/log/apache2/<%= name %>_error.log
|
||||
LogLevel warn
|
||||
CustomLog /var/log/apache2/<%= name %>_access.log combined
|
||||
ServerSignature On
|
||||
</VirtualHost>
|
1
pkg/puppetlabs-apache-0.0.2/tests/apache.pp
Normal file
1
pkg/puppetlabs-apache-0.0.2/tests/apache.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache
|
1
pkg/puppetlabs-apache-0.0.2/tests/dev.pp
Normal file
1
pkg/puppetlabs-apache-0.0.2/tests/dev.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::dev
|
1
pkg/puppetlabs-apache-0.0.2/tests/init.pp
Normal file
1
pkg/puppetlabs-apache-0.0.2/tests/init.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache
|
1
pkg/puppetlabs-apache-0.0.2/tests/php.pp
Normal file
1
pkg/puppetlabs-apache-0.0.2/tests/php.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::php
|
1
pkg/puppetlabs-apache-0.0.2/tests/ssl.pp
Normal file
1
pkg/puppetlabs-apache-0.0.2/tests/ssl.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::ssl
|
2
pkg/puppetlabs-apache-0.0.2/tests/vhost.pp
Normal file
2
pkg/puppetlabs-apache-0.0.2/tests/vhost.pp
Normal file
@ -0,0 +1,2 @@
|
||||
include apache
|
||||
apache::vhost { 'test.vhost': source => 'puppet:///modules/apache/test.vhost' }
|
BIN
pkg/puppetlabs-apache-0.0.3.tar.gz
Normal file
BIN
pkg/puppetlabs-apache-0.0.3.tar.gz
Normal file
Binary file not shown.
2
pkg/puppetlabs-apache-0.0.3/Modulefile
Normal file
2
pkg/puppetlabs-apache-0.0.3/Modulefile
Normal file
@ -0,0 +1,2 @@
|
||||
name 'puppetlabs-apache'
|
||||
version '0.0.3'
|
24
pkg/puppetlabs-apache-0.0.3/files/httpd
Normal file
24
pkg/puppetlabs-apache-0.0.3/files/httpd
Normal file
@ -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`
|
18
pkg/puppetlabs-apache-0.0.3/files/test.vhost
Normal file
18
pkg/puppetlabs-apache-0.0.3/files/test.vhost
Normal file
@ -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>
|
@ -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
|
12
pkg/puppetlabs-apache-0.0.3/lib/puppet/type/a2mod.rb
Normal file
12
pkg/puppetlabs-apache-0.0.3/lib/puppet/type/a2mod.rb
Normal file
@ -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
|
18
pkg/puppetlabs-apache-0.0.3/manifests/dev.pp
Normal file
18
pkg/puppetlabs-apache-0.0.3/manifests/dev.pp
Normal file
@ -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}
|
||||
}
|
44
pkg/puppetlabs-apache-0.0.3/manifests/init.pp
Normal file
44
pkg/puppetlabs-apache-0.0.3/manifests/init.pp
Normal file
@ -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'],
|
||||
}
|
||||
}
|
47
pkg/puppetlabs-apache-0.0.3/manifests/params.pp
Normal file
47
pkg/puppetlabs-apache-0.0.3/manifests/params.pp
Normal file
@ -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/'
|
||||
}
|
||||
}
|
||||
}
|
22
pkg/puppetlabs-apache-0.0.3/manifests/php.pp
Normal file
22
pkg/puppetlabs-apache-0.0.3/manifests/php.pp
Normal file
@ -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,
|
||||
}
|
||||
}
|
29
pkg/puppetlabs-apache-0.0.3/manifests/ssl.pp
Normal file
29
pkg/puppetlabs-apache-0.0.3/manifests/ssl.pp
Normal file
@ -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, }
|
||||
}
|
||||
}
|
||||
}
|
38
pkg/puppetlabs-apache-0.0.3/manifests/vhost.pp
Normal file
38
pkg/puppetlabs-apache-0.0.3/manifests/vhost.pp
Normal file
@ -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'],
|
||||
}
|
||||
}
|
51
pkg/puppetlabs-apache-0.0.3/metadata.json
Normal file
51
pkg/puppetlabs-apache-0.0.3/metadata.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"types": [
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "ensure",
|
||||
"doc": "The basic property that the resource should be in. Valid values are ``present``, ``absent``."
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "name",
|
||||
"doc": "The name of the module to be managed"
|
||||
}
|
||||
],
|
||||
"name": "a2mod",
|
||||
"providers": [
|
||||
{
|
||||
"name": "a2mod",
|
||||
"doc": "Manage Apache 2 modules on Debian and Ubuntu Required binaries: ``a2enmod``, ``a2dismod``. Default for ``operatingsystem`` == ``debianubuntu``. "
|
||||
}
|
||||
],
|
||||
"doc": "Manage Apache 2 modules on Debian and Ubuntu"
|
||||
}
|
||||
],
|
||||
"checksums": {
|
||||
"manifests/params.pp": "8728cf041cdd94bb0899170eb2b417d9",
|
||||
"tests/ssl.pp": "191912535199531fd631f911c6329e56",
|
||||
"tests/vhost.pp": "1b91e03c8ef89a7ecb6793831ac18399",
|
||||
"manifests/php.pp": "8a5ca4035b1c22892923f3fde55e3d5e",
|
||||
"files/httpd": "295f5e924afe6f752d29327e73fe6d0a",
|
||||
"tests/php.pp": "ce7bb9eef69d32b42a32ce32d9653625",
|
||||
"lib/puppet/provider/a2mod/a2mod.rb": "18c5bb180b75a2375e95e07f88a94257",
|
||||
"files/test.vhost": "0602022c19a7b6b289f218c7b93c1aea",
|
||||
"manifests/ssl.pp": "11ed1861298c72cca3a706480bb0b67c",
|
||||
"manifests/dev.pp": "bc54a5af648cb04b7b3bb0e3f7be6543",
|
||||
"manifests/vhost.pp": "7806a6c098e217da046d0555314756c4",
|
||||
"tests/init.pp": "4eac4a7ef68499854c54a78879e25535",
|
||||
"lib/puppet/type/a2mod.rb": "0e1b4843431413a10320ac1f6a055d15",
|
||||
"tests/apache.pp": "4eac4a7ef68499854c54a78879e25535",
|
||||
"tests/dev.pp": "4cf15c1fecea3ca86009f182b402c7ab",
|
||||
"templates/vhost-default.conf.erb": "ed64a53af0d7bad762176a98c9ea3e62",
|
||||
"manifests/init.pp": "9ef7e081c832bca8f861c3a9feb9949d",
|
||||
"Modulefile": "9b7a414bf15b06afe2f011068fcaff52"
|
||||
},
|
||||
"version": "0.0.3",
|
||||
"name": "puppetlabs-apache"
|
||||
}
|
25
pkg/puppetlabs-apache-0.0.3/templates/vhost-default.conf.erb
Normal file
25
pkg/puppetlabs-apache-0.0.3/templates/vhost-default.conf.erb
Normal file
@ -0,0 +1,25 @@
|
||||
# ************************************
|
||||
# Default template in module puppetlabs-apache
|
||||
# Managed by Puppet
|
||||
# ************************************
|
||||
|
||||
NameVirtualHost *:<%= port %>
|
||||
<VirtualHost *:<%= port %>>
|
||||
ServerName <%= name %>
|
||||
<%if serveraliases.is_a? Array -%>
|
||||
<% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
|
||||
<% elsif serveraliases != '' -%>
|
||||
<%= " ServerAlias #{serveraliases}" -%>
|
||||
<% end -%>
|
||||
DocumentRoot <%= docroot %>
|
||||
<Directory <%= docroot %>>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
ErrorLog /var/log/apache2/<%= name %>_error.log
|
||||
LogLevel warn
|
||||
CustomLog /var/log/apache2/<%= name %>_access.log combined
|
||||
ServerSignature On
|
||||
</VirtualHost>
|
1
pkg/puppetlabs-apache-0.0.3/tests/apache.pp
Normal file
1
pkg/puppetlabs-apache-0.0.3/tests/apache.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache
|
1
pkg/puppetlabs-apache-0.0.3/tests/dev.pp
Normal file
1
pkg/puppetlabs-apache-0.0.3/tests/dev.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::dev
|
1
pkg/puppetlabs-apache-0.0.3/tests/init.pp
Normal file
1
pkg/puppetlabs-apache-0.0.3/tests/init.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache
|
1
pkg/puppetlabs-apache-0.0.3/tests/php.pp
Normal file
1
pkg/puppetlabs-apache-0.0.3/tests/php.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::php
|
1
pkg/puppetlabs-apache-0.0.3/tests/ssl.pp
Normal file
1
pkg/puppetlabs-apache-0.0.3/tests/ssl.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::ssl
|
2
pkg/puppetlabs-apache-0.0.3/tests/vhost.pp
Normal file
2
pkg/puppetlabs-apache-0.0.3/tests/vhost.pp
Normal file
@ -0,0 +1,2 @@
|
||||
include apache
|
||||
apache::vhost { 'test.vhost': source => 'puppet:///modules/apache/test.vhost' }
|
25
templates/vhost-default.conf.erb
Normal file
25
templates/vhost-default.conf.erb
Normal file
@ -0,0 +1,25 @@
|
||||
# ************************************
|
||||
# Default template in module puppetlabs-apache
|
||||
# Managed by Puppet
|
||||
# ************************************
|
||||
|
||||
NameVirtualHost *:<%= port %>
|
||||
<VirtualHost *:<%= port %>>
|
||||
ServerName <%= name %>
|
||||
<%if serveraliases.is_a? Array -%>
|
||||
<% serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
|
||||
<% elsif serveraliases != '' -%>
|
||||
<%= " ServerAlias #{serveraliases}" -%>
|
||||
<% end -%>
|
||||
DocumentRoot <%= docroot %>
|
||||
<Directory <%= docroot %>>
|
||||
Options Indexes FollowSymLinks MultiViews
|
||||
AllowOverride None
|
||||
Order allow,deny
|
||||
allow from all
|
||||
</Directory>
|
||||
ErrorLog /var/log/apache2/<%= name %>_error.log
|
||||
LogLevel warn
|
||||
CustomLog /var/log/apache2/<%= name %>_access.log combined
|
||||
ServerSignature On
|
||||
</VirtualHost>
|
1
tests/apache.pp
Normal file
1
tests/apache.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache
|
1
tests/dev.pp
Normal file
1
tests/dev.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::dev
|
1
tests/init.pp
Normal file
1
tests/init.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache
|
1
tests/php.pp
Normal file
1
tests/php.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::php
|
1
tests/ssl.pp
Normal file
1
tests/ssl.pp
Normal file
@ -0,0 +1 @@
|
||||
include apache::ssl
|
2
tests/vhost.pp
Normal file
2
tests/vhost.pp
Normal file
@ -0,0 +1,2 @@
|
||||
include apache
|
||||
apache::vhost { 'test.vhost': source => 'puppet:///modules/apache/test.vhost' }
|
Loading…
Reference in New Issue
Block a user