On 05/02/2011 09:28 AM, Andreas Kuntzagk wrote: > Hi, > >>> Since I also have many nfsmounts and want to make sure that the >>> mountpoint >>> exist, I'd like to use require. Is there a way I can reference the >>> name of >>> the mountpoint in the require? Like so. >>> >>> mount {"test2": >>> device => "server1:/test2", >>> require => File[$name] >>> } >> >> If you have a file resource dependent on a Mount['test2'], the require >> attribute should be in the file resource. > > No, it's the other way around. The mount is depending on the existence > of the mountpoint otherwise the mount command fails. I can write > > mount { "/test2": > device => "server1:/test2", > require => File["/test2"], > } > > but to make this test default for all nfs mounts I want something like > > Mount { ... > require => File[$mountpoint] > } > > where $mountpoint is automatically set to the correct mountpoint of the > current mount.
That won't work out of the box, but you can do it in a defined type: define mount_wrapper($device,...) mount { "$name": device => $device, ..., require => File["$name"] } } That type will probably declare the very file resource as well. HTH, Felix -- 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.