Hi, I''m still quite new to puppet so forgive me if I ask stupid questions or use wrong terminology. I have default values for mount defined inside a class. Are these defaults only valid for mounts of this class or for all? class test { Mount { fstype => "nfs4", } mount{"test1": device => "server1:/test", } } 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] } regards, Andreas -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Fri, Apr 29, 2011 at 7:27 AM, Andreas Kuntzagk <andreas.kuntzagk@mdc-berlin.de> wrote:> Hi, > > I''m still quite new to puppet so forgive me if I ask stupid questions or use > wrong terminology. > > I have default values for mount defined inside a class. Are these defaults > only valid for mounts of this class or for all? > > class test { > > Mount { > fstype => "nfs4", > } > mount{"test1": > device => "server1:/test", > } > }Resource defaults apply to all resource in the same scope, so Mount defaults apply to all mount resource in the class test and not your entire manifests. Be aware this will propagate to classes you include in test so class a would be affected as well in the example below: class test { include a Mount {...} }> 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. file { "/test2/" ensure => directory, require => Mount[''test2''], } Nan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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. regards, Andreas -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.