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

Add ensure parameter to apache::listen.

This allows users to stop listening to specific URLs (address/ports).
parent b394d9b4
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2014 Thomas Bellman. # Copyright (C) 2014-2024 Thomas Bellman.
# Licensed under the GNU LGPL v3+; see the README file for more information. # Licensed under the GNU LGPL v3+; see the README file for more information.
...@@ -26,15 +26,42 @@ ...@@ -26,15 +26,42 @@
* combination more than once, so named virtual hosts need to coordinate * combination more than once, so named virtual hosts need to coordinate
* the set of listening addresses between themselves. This is not * the set of listening addresses between themselves. This is not
* enforced by this definition, but by Apache. * enforced by this definition, but by Apache.
*
* To stop listening on a set of URLs, specify the 'ensure' parameter
* with the value 'absent'. If you just remove the apache::listen
* resource, the include file containing the Listen directives will be
* removed, but there will still be an Include directive referencing it,
* and Apache httpd will refuse to start!
*/ */
define apache::listen($urls) define apache::listen(
$urls = false,
$ensure = 'present',
)
{ {
include apache::listen::no_global_listen include apache::listen::no_global_listen
apache::include_file { case $ensure
"_Listen_${name}": {
content => template('apache/listen.erb'); 'present': {
if ($urls == false) {
fail("Apache::Listen[${title}]: Bad urls parameter, ${urls}")
}
apache::include_file {
"_Listen_${name}":
ensure => $ensure,
content => template('apache/listen.erb');
}
}
'absent': {
apache::include_file {
"_Listen_${name}":
ensure => $ensure;
}
}
default: {
fail("Apache::Listen[${title}]: Bad parameter ensure, ${ensure}")
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment