On 8/7/2013 6:55 AM, [email protected] wrote:
Hi,
I use puppet to manage servers in a mutualized hosting context and I get
some trouble concerning the node definitions.
For example on dns nodes I have to declare many `bind::zone` resources
like this:
bind::zone { ['website1.com']:
expire => 604800,
minimum => 3600,
ttl => 38400,
…
records => [
'www IN A xxx.xxx.xxx.xxx'
…
]
}
bind::zone { ['website2.com']:
expire => 604800,
minimum => 3600,
ttl => 38400,
…
records => [
'www IN A xxx.xxx.xxx.xxx'
…
]
}
… and hundred others like this.
Finally, the file containing node definition became very big and
difficult to maintain.
I have the same issue for a webserver with apache::vhost resources for
example.
For the moment I use a workaround like this:
import vhosts/*.pp
And in each files I put a condition to make a restriction for a
particular nodes like this:
if $::fqdn =~ /^web(\d*)\.example\.net$/ {
apache::vhost { 'website2':
…
}
}
I suppose that many puppet users use puppet to manage nodes in
mutualized hosting context and I would ask if someone have a better
solution for this issue?
You might consider using create_resources with hiera. Here's a simple
example.
yaml data
---
apache::a2mods:
expires: {}
gnutls: {}
headers: {}
rewrite: {}
apache::vhosts:
statsstage.example.com:
priority: '99'
a_template: 'apache/vhosts/stats.example.com.erb'
stage.example.com:
priority: '00'
And the class the queries Hiera and pumps the data through various defines.
class profile::apache {
include ::apache
include logrotate::apache
$mymods = hiera('apache::a2mods', {})
create_resources('apache::a2mod', $mymods)
$myvhosts = hiera('apache::vhosts', {})
create_resources('apache::vhost', $myvhosts)
}
Ramin
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.