I have just gotten to playing with this and am doing something wrong, probably very basic.
On the puppetmaster (which for my testing is also the client) I have create_resources.rb in /var/lib/puppet/lib/puppet/parser/functions. I wrote a new ENC that will just output a very basic YAML to test this, the output is: classes: yumreposerver: yumreposerver::locations: centos5: distro: centos version: 5.6 In my modules directory I have yumreposerver/manifests/locations.pp: class yumreposerver::locations ( $instances = {} ) { create_resources('yumreposerver::location', $instances) } yumreposerver/manifests/location.pp: define yumreposerver::location( $distro, $version ) { ..... } puppet agent -t --noop returns: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter yumreposerver::locations on node <name> Puppet version 2.6.9 on SL6. Any insight as to where I have gone wrong? Thanks, jl On Wed, Jul 6, 2011 at 7:22 AM, Justin Lambert <jlamb...@localmatters.com>wrote: > This looks exactly like what I was looking for, thank you. This might be > worth mentioning on the ENC page so people like myself can find it easier. > > > On Tue, Jul 5, 2011 at 10:42 PM, Dan Bode <d...@puppetlabs.com> wrote: > >> Hi J, >> >> The create resources function was created to serve this exact use case >> (the README actually mentions your exact use case :) ) >> >> https://github.com/puppetlabs/puppetlabs-create_resources >> >> This will require 2.6.5 or higher to work (That is the first version where >> ENC's support param classes) >> >> The function was also merged into core in 2.7.0 >> >> -Dan >> >> On Tue, Jul 5, 2011 at 1:40 PM, Justin Lambert <jlamb...@localmatters.com >> > wrote: >> >>> I have recently started moving the config of our puppet hosts out of the >>> nodes files and into an ENC so they can be managed through a web UI by >>> someone with less technical experience without the fear of a typo causing a >>> failure of all catalogs to compile. As a result, I have been looking at >>> which modules need to be rewritten to support this. The problem I have run >>> into is, how do you do something such as add multiple virtual hosts using >>> the YAML output of an ENC? >>> >>> I currently have something like: >>> >>> node 'web01.company.com' { >>> apache::virtualhost { 'site1': location => '/hosted/site1', url => ' >>> http://site1.com' } >>> apache::virtualhost { 'site2': location => '/hosted/site2', url => ' >>> http://site2.com' } >>> } >>> >>> This uses 'define apache::virtualhost' in order to create multiple sites, >>> works fine. The YAML from an ENC (referencing >>> http://docs.puppetlabs.com/guides/external_nodes.html) doesn't look to >>> support this kind of definition so I need to find an alternative. My next >>> thought was that I can pass parameters to a parameterized class. No love >>> there as you can't instantiate a class multiple times with different >>> parameters. How are others solving this issue? >>> >>> Thanks, >>> jl >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Puppet Users" group. >>> To post to this group, send email to puppet-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> puppet-users+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/puppet-users?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.