Take a look at this page: http://docs.puppetlabs.com/hiera/3.0/puppet.html . The section entitled "Automatic Parameter Lookup" explains how to specify puppet class parameters in hiera.
- Chad On Tue, Sep 15, 2015 at 7:23 PM, Chris Jefferies <[email protected]> wrote: > > > At my office we use puppet hiera. The general approach has been to use key > value pairs in the yaml files as the source for variables in the modules > which are defined with snippets that look like this: > > hiera('some_hiera_variable', 'www.google.com') > > The main puppet init.pp is a small piece of config pointing to hiera > backend. All the hosts/nodes are defined in role based YAMLs and invoke > various modules with their associated configs and service modules. After > that there is a list of key value pairs that are used in the modules with > the hiera() function. > > So when I download modules from sourceforge I note that none I've looked at > so far refer to hiera or have variables like the above example. > > Is there a way to reference a module's parameters from the hiera and if so, > what's the basic approach? For instance, if the module documentation from > puppetforge shows blocks like these (which would be defined in a site.pp): > > class {'::icinga': > dbtype => 'mysql', > dbhost => 'localhost', > dbuser => 'icinga', > dbpasswd => 'icinga', > dbname => 'icinga', > } > > > icinga::classicui::user {'username': > passwd => 'HashPa22worD', > } > > class{'::icinga': > initdb => true, > with_classicui => true, > enabled_features => ['statusdata', 'compatlog', 'command'], > } > > > class { 'apache': > default_vhost => false, > } > > ...how does one translate these into hiera definitions? Perhaps there is a > tutorial on this subject? > > I am reticent to start seeding the module code with hiera() variables > because it seems I'll end up with custom code and unable to retrieve module > updates that would overwrite my changes. > > Sorry to be such a noob on the subject but any tips would be appreciated. > > Thanks, Chris. > > -- > 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/002b3a69-9f89-4bd6-96de-e9b4b373038c%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Chad M. Huneycutt -- 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/CAOJfo14w3c2%2Bm14Y84RoqzUgbfEAG4vPKZQzsiEt7KfNcgMiAw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
