Ask Your Question
0

is it possible to set default values for all vhosts

asked 2015-06-25 08:49:54 -0500

SimonH gravatar image

updated 2015-06-25 11:21:16 -0500

GregLarkin gravatar image

We're evaluating whether we can use puppetlabs-apache for our web deployment, and it's looking good.

One question I've not been able to find a solution for is if it's possible to set default values to be applied to all vhosts (and even better if we could differentiate between ssl & non-ssl hosts).

As a simple example, we might have the following setup in hiera

apache::vhosts
  host1:
    port: 80
    servername: host1.com
    serveradmin: mail@xx.com
  host2:
    port: 80
    servername: host1.com
    serveradmin: mail@xx.com
  host3:
    port: 80
    servername: host1.com
    serveradmin: web@xx.com

Ideally, I'd like to be able to do something like:

apache::vhosts
  default:
    serveradmin: mail@xx.com
  host1:
    port: 80
    servername: host1.com
  host2:
    port: 80
    servername: host1.com
  host3:
    port: 80
    servername: host1.com
    serveradmin: web@xx.com

with the default: entry providing values unless they're explicitly overridden.

Can anyone suggests a way to do this - the only option I've come up with so far is to modify the template files.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2015-06-25 11:23:54 -0500

GregLarkin gravatar image

Yes, you can do that if you completely define your Apache vhost resources in your Hiera data file.

The create_resources function accepts a third argument containing a hash of default values, and you can retrieve that data from your default key.

edit flag offensive delete link more

Comments

Thanks, works perfectly

SimonH gravatar imageSimonH ( 2015-06-26 08:43:18 -0500 )edit

Great, glad it worked!

GregLarkin gravatar imageGregLarkin ( 2015-06-26 14:41:09 -0500 )edit
1

answered 2015-06-29 03:04:16 -0500

sfozz gravatar image

You can also set defaults using the following in your manifests (eg site.pp for environment level defaults)

Apache::Vhost {
  serveradmin => 'webmaster@example.com',
}
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: 2015-06-25 08:49:54 -0500

Seen: 185 times

Last updated: Jun 29 '15