Thanks for your reply Fenix. By environment I meant Puppet environment, so for example, I'd have production and development. Production contains Varnish, Development is always non-Varnish. I then have a selector in the apache module which, depending on the environment, grabs a Hiera value, so something like:
$apachelisten = $::environment ? { 'production' => $apache::params::prod_listen, 'development' => $apache::params::dev_listen, } Then in params.pp: class apache::params { $prod_listen = hiera('apache_prod_listen') etc. or do you think there is a better way of doing this with Hiera? On Jun 7, 10:54 am, Felix Frank <felix.fr...@alumni.tu-berlin.de> wrote: > On 06/07/2012 11:30 AM, Andy Taylor wrote: > > > 1. Have Varnish/non-Varnish systems separated by environment and have > > a conditional in the module which changes the listen port dependent on > > the environment of the node; > > What do you mean by "environment"? I think this should be a hiera based > approach, which would seem all right to me. > > > 2. Use the 'defined' function (I've done a fair bit of reading on > > this, and it looks like it isn't really recommended due to parse order > > issues, and might even be removed in a future Puppet release) > > Exactly. Don't do this. > > > 3. Have the Varnish module create a resource of some sort and have the > > Apache module check for its existence. But I assume I will run into > > parse ordering issues with this, unless I put Varnish in a pre run > > stage or similar. > > As long as your dependencies are simple, you can do a subclass based > approach. Say your apache port is defined inside the apache::config > class, you could devise something like this: > > class apache::config::alt_port($port) inherits apache::config { > # override the contents of ports config file > File["/etc/apache2/ports.conf"] { content => ... } > > } > > Then the varnish module includes this subclass > > class { "apache::config::alt_port": port => "8080" } > > Note that this will get you in trouble as soon as two separate instances > want to fiddle with apache's port. > A hiera based approach will most likely allow you to keep things much > cleaner. > > Cheers, > Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.