Rename apache2 to httpd globally

This renames the classes and defined types from apache to httpd.
With the 'httpd' module available, we can migrate usage of 'apache'
to 'httpd.' Eventually this will free the 'apache' namespace.

A native ruby type and provider is contained in this class. It is
not namespaced to the class name so it has been renamed from a2mod
to httpd_mod.

Change-Id: I056eb28a13e7ccc95f1496019bedc332c17dd458
This commit is contained in:
Spencer Krum 2015-01-28 19:51:43 -08:00
parent 584c62b5d3
commit dab0f45bea
17 changed files with 89 additions and 88 deletions

View File

@ -1,12 +0,0 @@
Puppet::Type.type(:a2mod).provide :modfix do
desc "Dummy provider for A2mod.
Fake nil resources when there is no crontab binary available. Allows
puppetd to run on a bootstrapped machine before a Cron package has been
installed. Workaround for: http://projects.puppetlabs.com/issues/2384
"
def self.instances
[]
end
end

View File

@ -1,4 +1,4 @@
Puppet::Type.type(:a2mod).provide(:a2mod) do
Puppet::Type.type(:httpd_mod).provide(:httpd_mod) do
desc "Manage Apache 2 modules on Debian and Ubuntu"
optional_commands :encmd => "a2enmod"

View File

@ -0,0 +1,13 @@
Puppet::Type.type(:httpd_mod).provide :modfix do
desc "Dummy provider for httpd_mod.
Fake nil resources when there is no a2enmod binary available. Allows
puppetd to run on a bootstrapped machine before apache package has been
installed. Workaround for: http://projects.puppetlabs.com/issues/2384
and followed up by https://tickets.puppetlabs.com/browse/MODULES-1725
"
def self.instances
[]
end
end

View File

@ -1,4 +1,4 @@
Puppet::Type.newtype(:a2mod) do
Puppet::Type.newtype(:httpd_mod) do
@doc = "Manage Apache 2 modules on Debian and Ubuntu"
ensurable

View File

@ -1,4 +1,4 @@
# Class: apache::dev
# Class: httpd::dev
#
# This class installs Apache development libraries
#
@ -11,11 +11,11 @@
#
# Sample Usage:
#
class apache::dev {
include apache::params
class httpd::dev {
include httpd::params
package { 'apache_dev_package':
ensure => installed,
name => $apache::params::apache_dev,
name => $httpd::params::apache_dev,
}
}

View File

@ -1,4 +1,4 @@
# Class: apache
# Class: httpd
#
# This class installs Apache
#
@ -12,24 +12,24 @@
#
# Sample Usage:
#
class apache {
include apache::params
class httpd {
include httpd::params
package { 'httpd':
ensure => installed,
name => $apache::params::apache_name,
name => $httpd::params::apache_name,
}
service { 'httpd':
ensure => running,
name => $apache::params::apache_name,
name => $httpd::params::apache_name,
enable => true,
subscribe => Package['httpd'],
}
file { 'httpd_vdir':
ensure => directory,
path => $apache::params::vdir,
path => $httpd::params::vdir,
recurse => true,
purge => true,
notify => Service['httpd'],

View File

@ -1,4 +1,4 @@
# Class: apache::mod::python
# Class: httpd::mod::python
#
# This class installs Python for Apache
#
@ -11,16 +11,16 @@
#
# Sample Usage:
#
class apache::mod::python {
include apache
class httpd::mod::python {
include httpd
package { 'mod_python_package':
ensure => installed,
name => $apache::params::mod_python_package,
name => $httpd::params::mod_python_package,
require => Package['httpd'];
}
a2mod { 'python': ensure => present; }
httpd_mod { 'python': ensure => present; }
}

View File

@ -1,4 +1,4 @@
# Class: apache::mod::wsgi
# Class: httpd::mod::wsgi
#
# This class installs wsgi for Apache
#
@ -11,16 +11,16 @@
#
# Sample Usage:
#
class apache::mod::wsgi {
include apache
class httpd::mod::wsgi {
include httpd
package { 'mod_wsgi_package':
ensure => installed,
name => $apache::params::mod_wsgi_package,
name => $httpd::params::mod_wsgi_package,
require => Package['httpd'];
}
a2mod { 'wsgi': ensure => present; }
httpd_mod { 'wsgi': ensure => present; }
}

View File

@ -1,4 +1,4 @@
# Class: apache::params
# Class: httpd::params
#
# This class manages Apache parameters
#
@ -17,12 +17,12 @@
#
# Sample Usage:
#
class apache::params {
class httpd::params {
$user = 'www-data'
$group = 'www-data'
$ssl = true
$template = 'apache/vhost-default.conf.erb'
$template = 'httpd/vhost-default.conf.erb'
$priority = '25'
$servername = ''
$serveraliases = ''

View File

@ -1,4 +1,4 @@
# Class: apache::php
# Class: httpd::php
#
# This class installs PHP for Apache
#
@ -12,11 +12,11 @@
#
# Sample Usage:
#
class apache::php {
include apache::params
class httpd::php {
include httpd::params
package { 'apache_php_package':
ensure => present,
name => $apache::params::php_package,
name => $httpd::params::php_package,
}
}

View File

@ -1,4 +1,4 @@
# Class: apache::python
# Class: httpd::python
#
# This class installs Python for Apache
#
@ -12,14 +12,14 @@
#
# Sample Usage:
#
class apache::python {
include apache::params
include apache
class httpd::python {
include httpd::params
include httpd
package { 'apache_python_package':
ensure => present,
name => $apache::params::python_package,
}
a2mod { 'python': ensure => present, }
httpd_mod { 'python': ensure => present, }
}

View File

@ -1,4 +1,4 @@
# Class: apache::ssl
# Class: httpd::ssl
#
# This class installs Apache SSL capabilities
#
@ -12,15 +12,15 @@
#
# Sample Usage:
#
class apache::ssl {
class httpd::ssl {
include apache
include httpd
case $::operatingsystem {
'centos', 'fedora', 'redhat', 'scientific': {
package { 'apache_ssl_package':
ensure => installed,
name => $apache::params::ssl_package,
name => $httpd::params::ssl_package,
require => Package['httpd'],
}
}
@ -28,7 +28,7 @@ class apache::ssl {
a2mod { 'ssl': ensure => present, }
}
default: {
fail( "${::operatingsystem} not defined in apache::ssl.")
fail( "${::operatingsystem} not defined in httpd::ssl.")
}
}
}

View File

@ -1,4 +1,4 @@
# Definition: apache::vhost
# Definition: httpd::vhost
#
# This class installs Apache Virtual Hosts
#
@ -19,32 +19,32 @@
# - Install Apache Virtual Hosts
#
# Requires:
# - The apache class
# - The httpd class
#
# Sample Usage:
# apache::vhost { 'site.name.fqdn':
# httpd::vhost { 'site.name.fqdn':
# priority => '20',
# port => '80',
# docroot => '/path/to/docroot',
# }
#
define apache::vhost(
define httpd::vhost(
$port,
$docroot,
$configure_firewall = true,
$ssl = $apache::params::ssl,
$template = $apache::params::template,
$priority = $apache::params::priority,
$servername = $apache::params::servername,
$serveraliases = $apache::params::serveraliases,
$auth = $apache::params::auth,
$redirect_ssl = $apache::params::redirect_ssl,
$options = $apache::params::options,
$apache_name = $apache::params::apache_name,
$vhost_name = $apache::params::vhost_name
$ssl = $httpd::params::ssl,
$template = $httpd::params::template,
$priority = $httpd::params::priority,
$servername = $httpd::params::servername,
$serveraliases = $httpd::params::serveraliases,
$auth = $httpd::params::auth,
$redirect_ssl = $httpd::params::redirect_ssl,
$options = $httpd::params::options,
$apache_name = $httpd::params::apache_name,
$vhost_name = $httpd::params::vhost_name
) {
include apache
include httpd
if $servername == '' {
$srvname = $name
@ -53,21 +53,21 @@ define apache::vhost(
}
if $ssl == true {
include apache::ssl
include httpd::ssl
}
# Since the template will use auth, redirect to https requires mod_rewrite
if $redirect_ssl == true {
case $::operatingsystem {
'debian','ubuntu': {
A2mod <| title == 'rewrite' |>
Httpd_mod <| title == 'rewrite' |>
}
default: { }
}
}
file { "${priority}-${name}.conf":
path => "${apache::params::vdir}/${priority}-${name}.conf",
path => "${httpd::params::vdir}/${priority}-${name}.conf",
content => template($template),
owner => 'root',
group => 'root',

View File

@ -1,4 +1,4 @@
# Define: apache::vhost::proxy
# Define: httpd::vhost::proxy
#
# Configures an apache vhost that will only proxy requests
#
@ -18,29 +18,29 @@
#
# Sample Usage:
#
define apache::vhost::proxy (
define httpd::vhost::proxy (
$port,
$dest,
$priority = '10',
$template = 'apache/vhost-proxy.conf.erb',
$template = 'httpd/vhost-proxy.conf.erb',
$servername = '',
$serveraliases = '',
$ssl = false,
$vhost_name = '*'
) {
include apache
include httpd
$apache_name = $apache::params::apache_name
$ssl_path = $apache::params::ssl_path
$apache_name = $httpd::params::apache_name
$ssl_path = $httpd::params::ssl_path
$srvname = $name
if $ssl == true {
include apache::ssl
include httpd::ssl
}
file { "${priority}-${name}":
path => "${apache::params::vdir}/${priority}-${name}",
path => "${httpd::params::vdir}/${priority}-${name}",
content => template($template),
owner => 'root',
group => 'root',

View File

@ -1,4 +1,4 @@
# Define: apache::vhost::redirect
# Define: httpd::vhost::redirect
#
# This class will create a vhost that does nothing more than redirect to a
# given location
@ -17,21 +17,21 @@
#
# Sample Usage:
#
define apache::vhost::redirect (
define httpd::vhost::redirect (
$port,
$dest,
$priority = '10',
$serveraliases = '',
$template = 'apache/vhost-redirect.conf.erb',
$template = 'httpd/vhost-redirect.conf.erb',
$vhost_name = '*'
) {
include apache
include httpd
$srvname = $name
file { "${priority}-${name}":
path => "${apache::params::vdir}/${priority}-${name}",
path => "${httpd::params::vdir}/${priority}-${name}",
content => template($template),
owner => 'root',
group => 'root',

View File

@ -1,5 +1,5 @@
# ************************************
# Default template in module puppetlabs-apache
# Default template in module openstackci-httpd
# Managed by Puppet
# ************************************
@ -18,9 +18,9 @@ NameVirtualHost <%= vhost_name %>:<%= port %>
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_error.log
ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= name %>_error.log
LogLevel warn
CustomLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_access.log combined
CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= name %>_access.log combined
ServerSignature Off
</VirtualHost>

View File

@ -20,9 +20,9 @@ NameVirtualHost <%= vhost_name %>:<%= port %>
ProxyPassReverse / <%= dest %>/
ProxyPreserveHost On
ErrorLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_error.log
ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= name %>_error.log
LogLevel warn
CustomLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_access.log combined
CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= name %>_access.log combined
</VirtualHost>