diff --git a/manifests/dev.pp b/manifests/dev.pp index ca16057..e25b2c2 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -14,8 +14,8 @@ class apache::dev { include apache::params - package { "apache_dev_package": - name => $apache::params::apache_dev, - ensure => installed + package { 'apache_dev_package': + ensure => installed, + name => $apache::params::apache_dev, } } diff --git a/manifests/init.pp b/manifests/init.pp index de41795..5fd2b85 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,20 +16,20 @@ class apache { include apache::params package { 'httpd': - name => $apache::params::apache_name, ensure => installed, + name => $apache::params::apache_name, } service { 'httpd': - name => $apache::params::apache_name, ensure => running, + name => $apache::params::apache_name, enable => true, subscribe => Package['httpd'], } - file { "httpd_vdir": - path => $apache::params::vdir, + file { 'httpd_vdir': ensure => directory, + path => $apache::params::vdir, recurse => true, purge => true, notify => Service['httpd'], diff --git a/manifests/mod/python.pp b/manifests/mod/python.pp index cf14048..fb536e6 100644 --- a/manifests/mod/python.pp +++ b/manifests/mod/python.pp @@ -1,13 +1,13 @@ class apache::mod::python { include apache - package { "mod_python_package": - name => $apache::params::mod_python_package, + package { 'mod_python_package': ensure => installed, - require => Package["httpd"]; + name => $apache::params::mod_python_package, + require => Package['httpd']; } - a2mod { "python": ensure => present; } + a2mod { 'python': ensure => present; } } diff --git a/manifests/mod/wsgi.pp b/manifests/mod/wsgi.pp index dd83ee7..28b15ca 100644 --- a/manifests/mod/wsgi.pp +++ b/manifests/mod/wsgi.pp @@ -1,13 +1,13 @@ class apache::mod::wsgi { include apache - package { "mod_wsgi_package": - name => $apache::params::mod_wsgi_package, + package { 'mod_wsgi_package': ensure => installed, - require => Package["httpd"]; + name => $apache::params::mod_wsgi_package, + require => Package['httpd']; } - a2mod { "wsgi": ensure => present; } + a2mod { 'wsgi': ensure => present; } } diff --git a/manifests/params.pp b/manifests/params.pp index 5d28a88..fd4bc92 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -5,7 +5,8 @@ # 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 $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 @@ -32,31 +33,31 @@ class apache::params { case $::operatingsystem { 'centos', 'redhat', 'fedora', 'scientific': { - $apache_name = 'httpd' - $php_package = 'php' - $mod_python_package = 'mod_python' - $mod_wsgi_package = 'mod_wsgi' - $ssl_package = 'mod_ssl' - $apache_dev = 'httpd-devel' - $vdir = '/etc/httpd/conf.d/' + $apache_name = 'httpd' + $php_package = 'php' + $mod_python_package = 'mod_python' + $mod_wsgi_package = 'mod_wsgi' + $ssl_package = 'mod_ssl' + $apache_dev = 'httpd-devel' + $vdir = '/etc/httpd/conf.d/' } 'ubuntu', 'debian': { - $apache_name = 'apache2' - $php_package = 'libapache2-mod-php5' - $mod_python_package = 'libapache2-mod-python' - $mod_wsgi_package = 'libapache2-mod-wsgi' - $ssl_package = 'apache-ssl' - $apache_dev = [ 'libaprutil1-dev', 'libapr1-dev', 'apache2-prefork-dev' ] - $vdir = '/etc/apache2/sites-enabled/' + $apache_name = 'apache2' + $php_package = 'libapache2-mod-php5' + $mod_python_package = 'libapache2-mod-python' + $mod_wsgi_package = 'libapache2-mod-wsgi' + $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' - $mod_python_package = 'libapache2-mod-python' - $mod_wsgi_package = 'libapache2-mod-wsgi' - $ssl_package = 'apache-ssl' - $apache_dev = 'apache-dev' - $vdir = '/etc/apache2/sites-enabled/' + $apache_name = 'apache2' + $php_package = 'libapache2-mod-php5' + $mod_python_package = 'libapache2-mod-python' + $mod_wsgi_package = 'libapache2-mod-wsgi' + $ssl_package = 'apache-ssl' + $apache_dev = 'apache-dev' + $vdir = '/etc/apache2/sites-enabled/' } } } diff --git a/manifests/php.pp b/manifests/php.pp index 6e78298..4ad0211 100644 --- a/manifests/php.pp +++ b/manifests/php.pp @@ -15,8 +15,8 @@ class apache::php { include apache::params - package { "apache_php_package": - name => $apache::params::php_package, + package { 'apache_php_package': ensure => present, + name => $apache::params::php_package, } } diff --git a/manifests/python.pp b/manifests/python.pp index 3257158..3395a8b 100644 --- a/manifests/python.pp +++ b/manifests/python.pp @@ -13,13 +13,13 @@ # Sample Usage: # class apache::python { - include apache::params - include apache + include apache::params + include apache - package { "apache_python_package": - name => $apache::params::python_package, + package { 'apache_python_package': ensure => present, + name => $apache::params::python_package, } - a2mod { "python": ensure => present, } + a2mod { 'python': ensure => present, } } diff --git a/manifests/ssl.pp b/manifests/ssl.pp index 4787f98..e7f3a98 100644 --- a/manifests/ssl.pp +++ b/manifests/ssl.pp @@ -17,15 +17,18 @@ class apache::ssl { include apache case $::operatingsystem { - 'centos', 'fedora', 'redhat', 'scientific': { - package { "apache_ssl_package": - name => "$apache::params::ssl_package", - ensure => installed, - require => Package['httpd'], - } - } - 'ubuntu', 'debian': { - a2mod { "ssl": ensure => present, } - } + 'centos', 'fedora', 'redhat', 'scientific': { + package { 'apache_ssl_package': + ensure => installed, + name => $apache::params::ssl_package, + require => Package['httpd'], + } + } + 'ubuntu', 'debian': { + a2mod { 'ssl': ensure => present, } + } + default: { + fail( "${::operatingsystem} not defined in apache::ssl.") + } } } diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 3101b71..a918907 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -8,7 +8,8 @@ # - The $ssl option is set true or false to enable SSL for this Virtual Host # - The $configure_firewall option is set to true or false to specify if # a firewall should be configured. -# - The $template option specifies whether to use the default template or override +# - The $template option specifies whether to use the default template or +# override # - The $priority of the site # - The $serveraliases of the site # - The $options for the given vhost @@ -70,7 +71,7 @@ define apache::vhost( content => template($template), owner => 'root', group => 'root', - mode => '755', + mode => '0755', require => Package['httpd'], notify => Service['httpd'], } @@ -80,8 +81,8 @@ define apache::vhost( @firewall { "0100-INPUT ACCEPT $port": action => 'accept', - dport => "$port", - proto => 'tcp' + dport => '$port', + proto => 'tcp' } } } diff --git a/manifests/vhost/proxy.pp b/manifests/vhost/proxy.pp index c7985c8..cab545d 100644 --- a/manifests/vhost/proxy.pp +++ b/manifests/vhost/proxy.pp @@ -22,7 +22,7 @@ define apache::vhost::proxy ( $port, $dest, $priority = '10', - $template = "apache/vhost-proxy.conf.erb", + $template = 'apache/vhost-proxy.conf.erb', $servername = '', $serveraliases = '', $ssl = false, @@ -44,7 +44,7 @@ define apache::vhost::proxy ( content => template($template), owner => 'root', group => 'root', - mode => '755', + mode => '0755', require => Package['httpd'], notify => Service['httpd'], } diff --git a/manifests/vhost/redirect.pp b/manifests/vhost/redirect.pp index 2f051ed..17c6c65 100644 --- a/manifests/vhost/redirect.pp +++ b/manifests/vhost/redirect.pp @@ -1,6 +1,7 @@ # Define: apache::vhost::redirect # -# This class will create a vhost that does nothing more than redirect to a given location +# This class will create a vhost that does nothing more than redirect to a +# given location # # Parameters: # $port: @@ -21,7 +22,7 @@ define apache::vhost::redirect ( $dest, $priority = '10', $serveraliases = '', - $template = "apache/vhost-redirect.conf.erb", + $template = 'apache/vhost-redirect.conf.erb', $vhost_name = '*' ) { @@ -34,7 +35,7 @@ define apache::vhost::redirect ( content => template($template), owner => 'root', group => 'root', - mode => '755', + mode => '0755', require => Package['httpd'], notify => Service['httpd'], } @@ -43,7 +44,7 @@ define apache::vhost::redirect ( @firewall { "0100-INPUT ACCEPT $port": jump => 'ACCEPT', - dport => "$port", + dport => '$port', proto => 'tcp' } }