You can fake interation. "$name" is a free variable for whatever you're
passing in. I have NOT tested this, but it might look something like this:

define my_mounts {
   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"],

       }
>
>
}

Then call it with:
my_mounts { $mounts: }


On Wed, Aug 21, 2013 at 2:39 PM, Forrie <for...@gmail.com> wrote:

> I have several NFS mounts to manage, on many systems.  On each system, I
> must ensure that the root directory and path exist and have the correct
> permissions beforehand, then ensure they are mounted in Puppet.
>
> For each, I would normally do:
>
>         file { "/home/directory1":
>>
>>                ensure => directory,
>>
>>                owner   => "user",
>>
>>                group  => "group",
>>
>>                mode   => "755",
>>
>>        }
>>
>>
>>>        mount { "/home/directory1":
>>
>>                device   => "our-thumper.domain.com:/export/directory1",
>>
>>                atboot   => yes,
>>
>>                fstype   => "nfs",
>>
>>                options  => "tcp,hard,intr,rw,bg",
>>
>>                name     => "/home/directory1",
>>
>>                ensure   => mounted,
>>
>>                remounts => true,
>>
>>                pass     => "0",
>>
>>                require => File["/home/directory1"],
>>
>>        }
>>
>>
>
> which isn't very efficient when you have a ton of them to mange.
>
> It doesn't appear that Puppet can iterate through an array, but could I do
> something like:
>
> file { "/home/directory1", "/home/directory2", "/home/directory3":
>
> but requiring this File will be a problem in the "mount" pass.
>
> Perhaps a template?
>
> How are others solving this sort of problem?   For me, it would be a lot
> easier (and more readable) if we could maintain an array at the top of the
> rules that contained either the full patch or the basename, then iterate
> through them.
>
>
>
> _F
>
>
>
>  --
> 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