I've got a bit stuck trying to implement something in Puppet. I'm hoping
I'm just looking at it the wrong way and somebody can point me in the
right direction :-)

So here's what I have. A definition that creates a site (it doesn't
really matter what it's creating):

define mymodule::site ($path) {
  # ... do some stuff ...
}

mymodule::site { 'sitename':
  path  => '/some/path',
}

This is fine. But what I want to do is create an arbitrary set of
symlinks along with the site. So I extend it something like this:

define mymodule::site ($path, $links) {
  # ... do some stuff ...
  mymodule::links { $links:
    path => $path,
  }
}

define mymodule::links () {
  # create a link: $name -> $path
}

mymodule::site { 'sitename':
  path  => '/some/path',
  links => [ 'foo', 'bar' ],
}

So this works. It creates my site, and calls mymodule::links for each link
separately.

The problem comes if I want to call mymodule::links with more than just
one changing parameter (I'm using $name above). I'd like to be able to
do something like this, but can't see how to make it work:

mymodule::site { 'sitename':
  path  => '/some/path',
  links => [ { 'link1' => 'target1' }, { 'link2' => 'target2' }, ],
}

But you can't pass a hash in through $name, and I can't see how I can
pass separate parameters each call of the definition. I'd like a for
loop really!

Any pointers? Am I looking at this completely the wrong way?

The only alternative I've come up with is to just manually create the
links with file resources where I call mymodule::site, but I ideally
wanted to encapsulate all the behaviour within the module.

Thanks in advance,

Tim.

-- 
Tim Bishop
http://www.bishnet.net/tim/
PGP Key: 0x5AE7D984

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