diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index 34af267f7..edfa8c9dd 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -137,6 +137,9 @@ # [*owner*] - Defines owner of the .conf file # [*group*] - Defines group of the .conf file # [*mode*] - Defines mode of the .conf file +# [*maintenance*] - A boolean value to set a vhost in maintenance +# [*maintenance_value*] - Value to return when maintenance is on. +# Default to return 503 # Actions: # # Requires: @@ -235,6 +238,7 @@ $group = $::nginx::config::global_group, $mode = $::nginx::config::global_mode, $maintenance = false, + $maintenance_value = 'return 503' ) { validate_re($ensure, '^(present|absent)$', diff --git a/templates/vhost/vhost_header.erb b/templates/vhost/vhost_header.erb index 3f577c5f9..3b280be05 100644 --- a/templates/vhost/vhost_header.erb +++ b/templates/vhost/vhost_header.erb @@ -108,7 +108,7 @@ server { set $maintenance "off"; <% end -%> if ($maintenance = "on") { - return 503; + <%= @maintenance_value %>; } <% if @rewrite_to_https -%> if ($ssl_protocol = "") { diff --git a/templates/vhost/vhost_ssl_header.erb b/templates/vhost/vhost_ssl_header.erb index a59317b9f..60b4d3b3f 100644 --- a/templates/vhost/vhost_ssl_header.erb +++ b/templates/vhost/vhost_ssl_header.erb @@ -82,7 +82,7 @@ server { set $maintenance "off"; <% end -%> if ($maintenance = "on") { - return 503; + <%= @maintenance_value %>; } <% if Array(@resolver).count > 0 -%> resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>;