... and $name is the default variable given to you by puppet, so you don't
have to define it.  Works like $_ in perl.


On Wed, Aug 21, 2013 at 7:18 PM, Peter Bukowinski <pmb...@gmail.com> wrote:

> You define an array-containing variable like this:
>
>     $mounts = [ 'directory1', 'directory2', 'directory3' ]
>
> You can also put newlines after the commas for easier reading. The
> following code should be functional:
>
> class test_case {
>     $mounts = [
>         'directory1',
>         'directory2',
>         'directory3',
>     ]
>     define my_mounts {
>         file { "/home/${name}":
>             ensure => directory,
>             owner => "$name",
>             mode => "0755",
>         }
>         mount { "/home/${name}":
>             device   => "our-thumper.domain.com:/export/${name}",
>
>             atboot   => yes,
>             fstype   => "nfs",
>             options  => "tcp,hard,intr,rw,bg",
>             name     => "/home/${name}",
>
>             ensure   => mounted,
>             remounts => true,
>             pass     => "0",
>             require => File["/home/${name}"],
>         }
>     }
>     my_mounts { $mounts: }
> }
>
> Of course, instead of defining the $mounts variable in the manifest
> itself, you can get that array via a custom fact or from hiera.
>
> --
> Peter
>
> On Aug 21, 2013, at 2:55 PM, Forrie <for...@gmail.com> wrote:
>
> So I would need to define $mounts, presumably as:
>
> $mounts = "directory1 directory2 directory3"
>
> ?
>
> Where is $name being defined here.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to