foreman_data_binding
Version information
Start using this module
Add this module to your Puppetfile:
mod 'domcleal-foreman_data_binding', '0.1.0'
Learn more about managing modules with a PuppetfileDocumentation
foreman_data_binding
Data binding terminus for Puppet 3+ that uses Foreman's smart class parameters feature to resolve class parameters. Drop-in replacement for Hiera.
Requires the foreman_param_lookup plugin to be installed on your Foreman server.
Why would you do this?
In a Foreman 1.1 setup, classes are added to a host or hostgroup and Foreman provides the list of classes and their parameters to Puppet through the ENC. However, if those classes then include others, the data has to be provided by the first set of classes - which can make for lots of duplication of parameter lists.
Puppet 3 adds data binding support with Hiera, so if a class is included, it uses the data binding implementation to look up all of the parameters, e.g.
# this gets added to the host in Foreman
class role::webserver {
include httpd
}
class httpd($document_root, $user, $group) {
# ...
}
Puppet 3 will look up httpd::document_root
, httpd::user
and httpd::group
automatically, without us needing to supply them in the role class.
When classes are imported in Foreman, you can create flexible matcher rules that allow a hierarchy of lookups to resolve class parameters.
Installation:
First install the foreman_param_lookup plugin on your Foreman server.
On your puppetmaster, install this module:
puppet module install domcleal/foreman_data_binding
or copy this directory to your modulepath.
Edit lib/puppet/indirector/foreman.rb
and set the $foreman_url
value, e.g. to
http://foreman/
.
In your puppetmaster's /etc/puppet/puppet.conf
, set:
[master]
data_binding_terminus = foreman
Restart the puppetmaster.
Usage
In Foreman, under Puppet Classes, ensure your classes have been imported.
Select a class, choose a parameter from the left hand list and edit the hierarchy and matchers. More info:
Copyright
Copyright (c) 2013 Red Hat Inc. See LICENSE.
Copyright (c) 2013 Red Hat Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.