Skip to content
Function to dynamically create resources from hashes
Ruby Puppet
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib/puppet/parser/functions
tests
.gitignore
LICENSE
Modulefile
README

README

- License - Apache Version 2.0
- Copyright - Puppetlabs 2011

This module contains a custom function for puppet that can be used to dynamically add resources to the catalog.

I wrote this to use with an external node classifier that consumes YAML.

The yaml specifies classes and passes hashes to those classes as parameters

classes:
  webserver::instances:
    instances:
      instance1:
        foo: bar
      instance2:
        foo: blah

Then puppet code can consume the hash parameters and convert then into resources

class webserver::instances (
  $instances = {}
) {
  create_resources('webserver::instance', $instances)
}

Now I can dynamically determine how webserver instances are deployed to nodes
by updating the YAML files.


Something went wrong with that request. Please try again.