On Wed, Aug 17, 2011 at 10:27 AM, treydock <treyd...@gmail.com> wrote:
> Does anyone have some examples of using this create_resources
> function, https://github.com/puppetlabs/puppetlabs-create_resources,
> ?  Based on the README example I can't figure out exactly how to
> change from using defines to using this function.  Maybe I
> misunderstand the purpose of create_resources...is it to replace
> defines, or is it to allow ENCs (for example) to use a define?

The purpose of create resources is not to replace define, but rather
to declare resource from a hash. This is typically used to work around
ENC limitation of class only so you can provide a hash to generate
resources for a node.

> Below is an example of a define I use for apache virtual hosts.  From
> the example on the functions readme, does "class webserver::instances"
> use the information in $instances?  So if I wanted to create files /
> directories from the information in $instances, would that be done in
> "class webserver::instances" or else where?
>
> Here's the example...
>
> node 'webserver' {
>    apache::vhost {
>        'drupal-multisite1':
>            domain          => 'com',
>            docroot         => '/var/www/example2.com/html',
>            options         => 'None',
>            override        => 'All',
>            protocol        => 'http';
>
>        'drupal-multisite2':
>            domain          => 'com',
>            docroot         => '/var/www/example2.com/html',
>            create_docroot  => false,
>            options         => 'None',
>            override        => 'All',
>            protocol        => 'http';
>    }
> }

So if you use create resource, instead of the section above would be:

$vhost = { 'drupal-multisite1' => { domain => 'com', ... } }

create_resource ("apache::vhost", $vhost)

It would not change your existing define apache::vhost.

Thanks,

Nan

-- 
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.

Reply via email to