[Puppet Users] Re: using content in file as input variables to a class/def?

2012-04-10 Thread Jaakan Shorter
Thanks alot that helped out big time! 

On Thursday, April 5, 2012 9:42:42 AM UTC-4, jcbollinger wrote:
>
>
>
> On Apr 4, 10:51 am, Jaakan Shorter  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 view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/3QCj0revVREJ.
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.



[Puppet Users] using content in file as input variables to a class/def?

2012-04-04 Thread Jaakan Shorter
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"

 

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/giGi-U4MQKEJ.
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.