[Puppet Users] Re: Using back-ported create_resources in 2.6.x

2011-08-17 Thread treydock
Ah ok! That makes more sense now.

Thanks
- Trey

On Aug 17, 12:59 pm, Nan Liu  wrote:
> On Wed, Aug 17, 2011 at 10:27 AM, treydock  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.



[Puppet Users] Re: Using back-ported create_resources in 2.6.x

2011-08-17 Thread treydock


On Aug 17, 12:59 pm, Nan Liu  wrote:
> On Wed, Aug 17, 2011 at 10:27 AM, treydock  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

Having a bit of trouble now...and the error I'm getting is of no help.

Here's my parameter in node definition


$redmine_instances = {
'default' => {
docroot => '/var/www/rails/redmine',
db  => 'redmine',
db_user => 'redmine',
db_pass => '',
},
}
create_resources('redmine::instance', $redmine_instances)

And the defines this is going to...


define redmine::instance (
$instances = {}
) {
file { "$instances[docroot]":
ensure  => directory,
owner   => 'apache',
}


file {"$instances[docroot]/config/database.yml":
content => "production:
  adapter: mysql
  database: $instances[db]
  host: localhost
  username: $instances[db_user]
  password: $instances[db_pass]
  encoding: utf8
",
}
}


That's a trimmed down example, but the error I get is 



# puppetd --test --debug -v --noop
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/
dscl does not exist
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting
false
debug: Puppet::Type::User::ProviderUser_role_add: file roleadd does
not exist
debug: Puppet::Type::File::ProviderMicrosoft_windows: feature
microsoft_windows is missing
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/
lib/puppet]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/
var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certs/client.tld.pem]: Autorequiring
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring File[/
var/lib/puppet/ssl/certs]
debug: /File[/etc/puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /File[/var/lib/puppet/state/last_run_report.yaml]:
Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/etc/puppet/namespaceauth.conf]: Autorequiring File[/etc/
puppet]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/
var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys/client.tld.pem]:
Autorequiring File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/state/last_run_summary.yaml]:
Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring File[/var/lib/
puppet/ssl]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/classes.txt]: Autorequiring File[/var/lib/
puppet]
debug: /File[/var/lib/puppet/client_yaml]: Aut