[Puppet Users] how to us a var in define as $namevar

2010-12-16 Thread Arnau Bria
Hi,

I have this code:

define software_mount ($vo_name) {
[...]
device  = server:/$vo_name,
[...]
}

And I'd like to use $vo_name a type name, so I could use it like:

software_mount { ['vo_name1' , 'vo_name2', ..., 'vo_nameN' ] }

or even:

software_mount { ['vo_name1' , 'vo_name2', ..., 'vo_nameN' ] : vo_name = 
$namevar }


I've been playing with $namevar inside the define, but all my tries fail
(I have a collection of errros and has no sense to post all of them).

Anyone could give a hand on this?

TIA,
Arnau

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



Re: [Puppet Users] how to us a var in define as $namevar

2010-12-16 Thread Nan Liu
On Thu, Dec 16, 2010 at 7:10 AM, Arnau Bria arnaub...@pic.es wrote:
 Hi,

 I have this code:

 define software_mount ($vo_name) {
        [...]
                device  = server:/$vo_name,
        [...]
 }

 And I'd like to use $vo_name a type name, so I could use it like:

 software_mount { ['vo_name1' , 'vo_name2', ..., 'vo_nameN' ] }

 or even:

 software_mount { ['vo_name1' , 'vo_name2', ..., 'vo_nameN' ] : vo_name = 
 $namevar }


 I've been playing with $namevar inside the define, but all my tries fail
 (I have a collection of errros and has no sense to post all of them).

 Anyone could give a hand on this?

If you want to use the resource title, simply use $title or $name
within the define.

define software_mount {
  notify { $name: }
}

software_mount {
  [foo, bar]:
}

Thanks,

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



Re: [Puppet Users] how to us a var in define as $namevar

2010-12-16 Thread Arnau Bria
On Thu, 16 Dec 2010 07:29:18 -0700
Nan Liu wrote:

 If you want to use the resource title, simply use $title or $name
 within the define.
yes it has more sense ..

 Thanks,
 
 Nan
Thanks,
Arnau

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