Skip to content
Snippets Groups Projects
Commit 12a8dea4 authored by Thomas Bellman's avatar Thomas Bellman
Browse files

Abstract the Apache service into a separate class.

In order for users to not need to know that the service is named
'httpd' (at least on RedHat:ish systems), the class apache::service
is added, abstracting that knowledge.
parent ef66fa07
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ class apache ...@@ -30,6 +30,7 @@ class apache
class apache::base class apache::base
{ {
include apache include apache
include apache::service
package { package {
'httpd': 'httpd':
...@@ -41,7 +42,7 @@ class apache::base ...@@ -41,7 +42,7 @@ class apache::base
$apache::configdir: $apache::configdir:
ensure => directory, ensure => directory,
recurse => true, purge => true, force => true, backup => false, recurse => true, purge => true, force => true, backup => false,
require => Package['httpd'], notify => Service['httpd']; require => Package['httpd'], notify => Class[apache::service];
} }
# We do not want to blindly include things in the conf.d directory. # We do not want to blindly include things in the conf.d directory.
ensure_line { ensure_line {
...@@ -50,8 +51,19 @@ class apache::base ...@@ -50,8 +51,19 @@ class apache::base
line => '##--Include conf.d/*.conf', line => '##--Include conf.d/*.conf',
pattern => '^\s*Include\s+conf\.d/\*\.conf\s*$', pattern => '^\s*Include\s+conf\.d/\*\.conf\s*$',
require => Package['httpd'], require => Package['httpd'],
notify => Service['httpd']; notify => Class[apache::service];
} }
}
/*
* Helper class for abstracting dependencies on the Apache service.
* This is so others can do e.g. notify => Class[apache::service] instead
* of having to do notify => Service['httpd'].
*/
class apache::service
{
service { service {
'httpd': 'httpd':
enable => true, ensure => $running, enable => true, ensure => $running,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment