diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000000000000000000000000000000000000..f6734bee52103c787759bf90f0c9e10908691ee4 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,60 @@ +# 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; + } +}