diff --git a/manifests/listen.pp b/manifests/listen.pp
index a278be2c4878efcefa7911babd60c504adbecd36..ef97c2655f6594f983983ee048ecd35b41144a89 100644
--- a/manifests/listen.pp
+++ b/manifests/listen.pp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014 Thomas Bellman.
+# Copyright (C) 2014-2024  Thomas Bellman.
 # Licensed under the GNU LGPL v3+; see the README file for more information.
 
 
@@ -26,15 +26,42 @@
  * combination more than once, so named virtual hosts need to coordinate
  * the set of listening addresses between themselves.  This is not
  * 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
 
-    apache::include_file {
-	"_Listen_${name}":
-	    content => template('apache/listen.erb');
+    case $ensure
+    {
+	'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}")
+	}
     }
 }