Hello,

sorry it took me so long to reply.

Thank you for the answer. That has helped me a lot and I think I'm on
the correct path now. It is just a lot more verbose than I had hoped
:)

> A custom function that expands the array would be a bit more
> universal, but you can still do this with puppet define resource type
> with no ruby code:
>
> define hadoop::mount {
>  file { "/mnt/${name}/hadoop":
>    ensure => directory,
>    owner => "root",
>    group => "hadoop",
>    require => Package["hadoop-0.20"]
>    ;
>  }
> }
>
> hadoop::mount {
>  ["disk1", "disk2", "disk3"]:
> }

This in combination with virtual resources seems to work[1]. It is
pretty complicated and unintuitive though as I can't require + realize
a virtual resource at the same time[2] so I have to add placebo
definitions that realize the resources so I can require them and
subscribe to them. I'm still in the process of converting everything
to virtual resources so it doesn't work at the moment but I'll see
tomorrow if I can get it working. Can slim it down afterwards if I
find better ways to do stuff.

> The difference between the system can be written as a custom fact, a
> variable set at top scope when defining the nodes, or use parametrized
> class (available in 2.6).
>
> class demo ($disk) {
>  case $disk {
>    "2" : {  # add resource specific for 2 disk }
>    "6" : {  # add resource specific for 6 disk }
>  }
>  # common for all system using class demo
> }
>
> node server1 {
>   class { "demo": disk => 2 }
> }
>
> node server2 {
>   class { "demo": disk => 6 }
> }

That looks interesting. I've read about those new parameterized
classes but skipped them for now. Thanks for the hint. I'll take a
look at it later when I got the basics working again.

Cheers,
Lars

[1] 
https://github.com/lfrancke/gbif-puppet/blob/master/modules/hadoop/manifests/init.pp#L22-66
[2] 
https://github.com/lfrancke/gbif-puppet/blob/master/modules/hadoop/manifests/namenode.pp#L19-24

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

Reply via email to