Browse Source

Merge pull request #738 from jkroepke/hiera_locations

Added locations paramater to use it in hiera.
James Fryman 8 years ago
parent
commit
0e3cddcd8d
1 changed files with 11 additions and 1 deletions
  1. 11 1
      manifests/resource/vhost.pp

+ 11 - 1
manifests/resource/vhost.pp

@@ -157,6 +157,7 @@
 #   [*maintenance*]             - A boolean value to set a vhost in maintenance
 #   [*maintenance_value*]       - Value to return when maintenance is on.
 #                                 Default to return 503
+#   [*locations*]               - Hash of vhosts ressources used by this vhost
 # Actions:
 #
 # Requires:
@@ -267,7 +268,8 @@ define nginx::resource::vhost (
   $group                        = $::nginx::config::global_group,
   $mode                         = $::nginx::config::global_mode,
   $maintenance                  = false,
-  $maintenance_value            = 'return 503'
+  $maintenance_value            = 'return 503',
+  $locations                    = {}
 ) {
 
   validate_re($ensure, '^(present|absent)$',
@@ -482,6 +484,7 @@ define nginx::resource::vhost (
   validate_array($rewrite_rules)
   validate_hash($string_mappings)
   validate_hash($geo_mappings)
+  validate_hash($locations)
 
   validate_string($owner)
   validate_string($group)
@@ -664,4 +667,11 @@ define nginx::resource::vhost (
 
   create_resources('::nginx::resource::map', $string_mappings)
   create_resources('::nginx::resource::geo', $geo_mappings)
+  create_resources('::nginx::resource::location', $locations, {
+    ensure   => $ensure,
+    vhost    => $name_sanitized,
+    ssl      => $ssl,
+    ssl_only => $ssl_only,
+    www_root => $www_root,
+  })
 }