deet wrote: > Obviously I hadn't taken into consideration on how I could support > multiple zpools on one host. Just figured this out as I went to add a > second zpool to the node headbone. So am I wanting to use > definitions to support creating multiple zpools (or whatever) per
In your case, I think the code in your most recent E-mail is probably close to what you need. So the answer is yes, for what you are trying to do use a define. But you don't always have to. If each has a different parameter then you have to split them out, but otherwise you can do: resource { [ "foo", "bar" ]: parm1 => "asdf", parm2 => ";lkj" } This is the equivalent of: resource { "foo": parm1 => "asdf", parm2 => ";lkj" } resource { "bar": parm1 => "asdf", parm2 => ";lkj" } You want a definition when you want to use $name or $title in a resource's parameters. Referring back to what I gave you, the use of $name in the File resources is why a define is necessary. If you didn't refer to $name ("foo" and "bar") in the resource you could have just done seperate File resources, but it would have broken the DRY principle. << define solaris::media($ensure = "present") { file { "solaris_media_${name}": path => "/opt/SUNWjet/etc/$name", content => template("jumpstart/${name}.erb"), ensure => $ensure, require => File[SUNWjet] # don't you mean Package[SUNWjet] ? } } ... $media_locs = [ "foo", "bar" ] solaris::media { $media_locs: ensure => present } >> compared to: << file { "solaris_media_foo": path => "/opt/SUNWjet/etc/foo", content => template("jumpstart/foo.erb"), ensure => present, require => File[SUNWjet] } file { "solaris_media_bar": path => "/opt/SUNWjet/etc/bar", content => template("jumpstart/bar.erb"), ensure => present, require => File[SUNWjet] } >> Both should have the same effect, but one is more extensible and requires a lot less typing :) NB, I would define variables in the node and try to avoid creating resources in the node itself (similar to what you initially had). Your manifests will be more dynamic and you can use external nodes: <http://reductivelabs.com/trac/puppet/wiki/ExternalNodes> Also check out extlookup. It's pretty cool: <http://www.devco.net/archives/2009/08/31/complex_data_and_puppet.php> -scott -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@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.