1

I'm using Jfryman puppet nginx module and I'm trying to enable status location with available vhosts , so my hiera go like this :

---
nginx::nginx_vhosts:
  'default':
    www_root: '/www/default'
    listen_port: 8081

  'default2':
    www_root: '/www/default2'
    listen_port: 8082

  'default3':
    www_root: '/www/default3'
    listen_port: 8083

nginx::nginx_locations:
  'status':
    location: '/status'
    vhost: 'default'...."here wanna include more than one vhost"
    stub_status: true

is there anyway to say like this location included in these vhosts without duplicating the hiera entries ?

A.Elnaggar
  • 240
  • 1
  • 2
  • 12

1 Answers1

1

No, the location type takes only one vhost parameter and uses it to determine the target file.

To keep things DRY, you will have to refrain from using the nginx_locations parameter of the nginx class, and declare the nginx::resource::location instances yourself.

define status_location_for_vhost() {
    nginx::resource::location { "status-for-$name":
        location => '/status',
        vhost    => $name,
        stub_status => true
    }
}

Declare on of those for each vhost.

Felix Frank
  • 8,125
  • 1
  • 23
  • 30
  • Thanks for your answer help so much, but just found that there is no need since the status is general for all vhosts, so it doesn't make sense to enable it per host – A.Elnaggar Aug 03 '15 at 14:35