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

Add basic installation of Apache web server.

This adds the classes 'apache', containing variables for various files
and directories that Apache uses, and 'apache::base', doing the basic
installation of the Apache package and starting of the service.
parent d7517faa
Branches
No related tags found
No related merge requests found
# Copyright (C) 2012 Thomas Bellman.
# Licensed under the GNU LGPL v3+; see the README file for more information.
import "nsc-puppet-utils"
/*
* Various Apache httpd constants.
* Mostly expected to be used internally by the classes and definitions
* below.
*/
class apache
{
$configfile = '/etc/httpd/conf/httpd.conf'
$configdir = '/etc/httpd/conf.d'
}
/*
* Basic installation of the Apache web server.
*
* This disables the reading of all everything in the conf.d directory,
* which the standard Apache configuration file in RedHat:is OS:es
* does, instead forcing users to explicitly load only those files
* they need. It will also remove all unmanaged files from that
* directory.
*/
class apache::base
{
include apache
package {
'httpd':
ensure => installed;
}
file {
# Keep the conf.d directory clean from all config files except for
# the ones explicitly managed from Puppet.
$apache::configdir:
ensure => directory,
recurse => true, purge => true, force => true, backup => false,
require => Package['httpd'], notify => Service['httpd'];
}
# We do not want to blindly include things in the conf.d directory.
ensure_line {
'apache::base::no_include_all':
file => $apache::configfile,
line => '##--Include conf.d/*.conf',
pattern => '^\s*Include\s+conf\.d/\*\.conf\s*$',
require => Package['httpd'],
notify => Service['httpd'];
}
service {
'httpd':
enable => true, ensure => $running,
hasstatus => true, hasrestart => true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment