On Tue, Feb 9, 2010 at 10:55 AM, Aurelien Degremont <aurelien.degrem...@cea.fr> wrote: > Frederik Wagner a écrit : >> >> Hi Aurelien, >> >> On Tue, Feb 9, 2010 at 9:32 AM, Aurelien Degremont >> <aurelien.degrem...@cea.fr> wrote: >>> >>> Frederik Wagner a écrit : >>>> >>>> Hi .*, >>>> >>>> I'm wondering if there is a way to have a virtual resource realize >>>> other virtual resources which it requires. >>>> >>>> Background: I want to create a module which provides all possible >>>> mountpoints from a NAS Filer as virtual resources, like @mount{xyz}. >>>> These mounts depend on some directory which must exists, and should >>>> only be created if the mount is realized (furthermore some nfs client >>>> options are only needed to be set if a nfs mount takes place at all). >>>> >>>> I would think that something like the following would do the job, but >>>> it doesn't. >>>> >>>> in some class: >>>> @file{"/mountpoint": ensure => directory } >>>> >>>> @mount{"/mountpoint": >>>> ..., >>>> require => File["/mountpoint"] >>>> } >>>> >>>> in some other class: >>>> Mount<| title == "/mountpoint" |> >>>> >>>> >>>> What am I missing? Or is this not possible at all? >>> >>> Hello >>> >>> I never really played with virtual ressources but it seems you forgot to >>> also realize the file object for your mountpoint? >> >> this is exactly the point of my problem, I would like to automatically >> realize all resources required by the mount without explicitly stating >> it in the module realizing the mount. All requirements should be >> encapsulated in the module providing the @mount. > > You need to create your own type with a define > > > define mymount($mountpoint) { > file { $mountpoint: > ensure => "directory" > } > > mount { $mountpoint: > require => File[$mountpoint], > } > } > > > @mymount{ "/mountpoint": > mountpoint => "/mountpoint" > } > > Mymount<| title == "/mount_point" |> > > > Not sure, but i think this is the good way.
good idea and I was thining in a similar direction, but in this way all the possible mounts are/must be created in the same way, i.e. in this case a file + a moutn ressource. I was looking for a generic way, let's say somthing like @mount{"/mountpoint": ..., require => File<| title == "/mountpoint"] |> } which would be great. The requirement is realized only when it is needed. Bye, Frederik > -- > Aurelien Degremont > CEA > > -- > 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. > > -- 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.