You could setup setup the host-specific yaml as:
vhost: “first.example.com”
port: “80”
priority: “10”
docroot: “/var/www/first”
Then your module:
$vhost = hiera(‘vhost’)
$port = hiera(‘port’)
$priority = hiera(‘priority’)
$docroot: = hiera(‘docroot’)
apache::vhost { $vhost:
port => $port,
priority => $priority,
docroot => $docroot,
}
This would allow you completely segregate the configuration from the data and
not require modification of the module code unless something in the
configuration changes. You could use common.yaml for configuration data that
applies to all hosts.
From: JeremyCampbell
Sent: Monday, August 25, 2014 5:04 AM
To: [email protected]
Subject: [Puppet Users] How can we satisfy goals of having all data in hiera
and not modifying the module code?
We understand that all site specific data should be in Hiera. We also
understand that modules shouldn't have to be modified when they are well
designed e.g. the puppetlabs/apache module. However, how do I setup apache
using this module with a virtual host without putting data into the manifest.
E.g to create a vhost according to the docs we need to use:
apache::vhost { 'first.example.com':
port => '80',
docroot => '/var/www/first',
}
As a define it would appear that we need to use create_resources() somewhere in
the module and then create a hash in hiera e.g.
apache::my_vhosts:
host1:
priority: "10"
vhost_name": "first.example.com"
port": "80"
docroot": "/var/www/first"
This means that we either need to put data into the manifest (e.g. first
example) or to change the module code by implementing create_resources(). So
how can we satisfy both goals of having all data in hiera and not modifying the
module code?
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/6f9aaec5-0503-488c-b70a-30887af5b353%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/7F6002FD5CA14856A2B8F6025998126D%40JimHPPavilionG6.
For more options, visit https://groups.google.com/d/optout.