Ask Your Question
0

How to create <Location> using apache module?

asked 2014-10-15 15:16:18 -0500

kyledecot gravatar image

I'm using the puppetlabs apache module and I need to create something like this:

<VirtualHost *:80>
    ...
    <Location /Shibboleth.sso>
        PassengerEnabled off
    </Location>
    ...
</VirtualHost>

So far I have this:

apache::vhost { "example":
  docroot => "...",
  servername => "example.com",
  locations => [
    { path => "/Shibboleth.sso", passengerEnabled => "off" }
  ]
}

This however gives me:

Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter locations on Apache::Vhost

What is the proper way to do this?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2015-08-03 22:55:44 -0500

muppetpuppet gravatar image

You need to use the provider of 'location' in the directories hash. See my example:

directories => [ {
                        provider    => 'location',
                        path        => '/server-status',
                        sethandler  => 'server-status',
                        order       => 'Deny,Allow',
                        deny        => 'from all',
                        allow       => 'from 127.0.0.1',
                    },]
edit flag offensive delete link more

Comments

this worked best for me - just added the 'provider' definition to my directories data...thanks !

vinceskahan gravatar imagevinceskahan ( 2015-12-23 09:35:04 -0500 )edit
1

answered 2014-10-17 19:56:44 -0500

cbarbour gravatar image

The functionality you're looking for is provided by the directories parameter to the apache::vhost defined type.

puppetlabs-apache is a very complex module. A reading of the code suggests that only directory locations are currently implemented; while the underlying template supports location and file blocks, the defined type hard codes this as a directory block

You basically have two options:

  1. Re-design your application to use the directory apache block instead of the location block.
  2. Deploy your vhost using a simple file resource rather than the apache::vhost defined type.

The latter is actually a fine solution; since sites-enabled/conf.d are .d style include directories, writing your own vhost template is a pretty low risk and simple solution if you need flexibility not provided by the vhost defined type. The only real loss is that you'll have to implement your own multi-platform logic to handle differences between Ubuntu, RHEL, etc.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-10-15 15:14:59 -0500

Seen: 803 times

Last updated: Oct 17 '14