On Apr 4, 10:51 am, Jaakan Shorter <jaakanshor...@gmail.com> wrote:
> Here is the setup
> Clients are all under /usr/home/ftp/$client
> Internal Production is /usr/home/$internaluser
>
> I need to make slinks for every client folder under every Internal
> Production ie: ln -s /usr/home/ftp/$client /usr/home/$internaluser/$client
> Is there a way to do this from a list with in two files ( one for client
> name and the other for internal user names)? where the list format would be
> like : "username", "uid"


Supposing that you want to manage these links directly via Puppet
(instead of, for instance, via a script on each node) then you could
do something like this:

class ftp::data {
   # More on these arrays later
   $clientnames = ...
   $internalusers = ...
}

define ftp::internaluserclientdir($internaluser) {
    file { "/usr/home/${internaluser}/${name}":
        ensure => 'link',
        target => "/usr/home/ftp/${name}"
    }
}

define ftp::internaluser() {
    include 'ftp::data'

    file { "/usr/home/${name}":
        ensure => 'directory',
        # ...
    }

    ftp::internaluserclientdir { ${ftp::data::clientnames}:
        internaluser => ${name}
    }
}

class ftp::clientdirs {
    include 'ftp::data'
    ftp::internaluser { ${ftp::data::internalusers}: }
}

Note that that manages the internal user directories themselves (which
you did not specify), but that's optional.  On the other hand, it does
not manage the actual client directories, though it could be made to
do.

Now, as to the actual source of the data.  If using a Puppet manifest
is an acceptable embodiment of storing the data in a file, then you
can just define the needed arrays directly in class "ftp::data".  It's
usually better, however, to pull the data out of your manifests, in
which case you should be looking at hiera.  In that case the variable
declarations in class "ftp::data" would use hiera to load their array
values, or else class "ftp::data" could be dropped altogether, and
your other classes could call hiera directly to get the data.


John

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to