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

Let named_vhost listen on URLs automatically.

Now that we support calling apache::listen multiple times on the same
address/port pair, we can let apache::named_vhost automatically listen
on the URLs it will handle.  Do so.

This will make it a little bit easier for users, who will no longer
need to instantiate both an apache::named_vhost resource, *and* an
apache::listen resource.  Perhaps not a huge deal, especially since
we now allow multiple apache::listen resources for the same address/
port pairs, but even a little bit helps.
parent 3ed70217
No related branches found
No related tags found
No related merge requests found
# Copyright (C) 2014-2022 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.
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
* - urls * - urls
* Specifies one or more addresses that this virtual host handles, i.e. * Specifies one or more addresses that this virtual host handles, i.e.
* which 'Listen' directives apply to it, on the format of URLs, in the * which 'Listen' directives apply to it, on the format of URLs, in the
* same format as apache::listen does. Listen directives must however * same format as apache::listen does. apache::listen will be called
* be configured separately; this definition does not do that for you. * automatically, so you don't need to do that separately (this is a new
* This parameter can be either a single URL, or a list of URLs. * behaviour since 2024).
* This parameter can be either a single URL, or a (possibly nested)
* list of URLs.
* *
* - servernames * - servernames
* Which hostnames in URLs this virtual host applies to. Translates * Which hostnames in URLs this virtual host applies to. Translates
...@@ -62,6 +64,10 @@ define apache::named_vhost($urls, ...@@ -62,6 +64,10 @@ define apache::named_vhost($urls,
if $certname { if $certname {
include x509certs include x509certs
} }
apache::listen {
"_vhost-${name}":
urls => $urls;
}
apache::include_file { apache::include_file {
"vhost-${name}": "vhost-${name}":
content => template('apache/named_vhost.conf.erb'), content => template('apache/named_vhost.conf.erb'),
...@@ -69,6 +75,10 @@ define apache::named_vhost($urls, ...@@ -69,6 +75,10 @@ define apache::named_vhost($urls,
} }
} }
'absent': { 'absent': {
apache::listen {
"_vhost-${name}":
ensure => absent;
}
apache::include_file { apache::include_file {
"vhost-${name}": "vhost-${name}":
ensure => absent; ensure => absent;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment