I have a solution for this that involves a custom fact, written in Ruby, for 
the user's homedir. 
I will gladly post the code for the fact and the manifest code showing how I 
use it.  However, I am posting this from home and all my Puppet code is at my 
work.  I will post it tomorrow.

One small "gotcha" that confuzzled me for a short while is that I found that 
this custom fact does not work for a user account that is created in the same 
puppet-agent run.  A bit of a chicken-egg dilemma: the fact depends on the 
existance of the user, but facts are done first in an agent run.  My solution 
is that you have the user's homedir available to you when you create an 
account, so my ssh-key code was refactored to include the homedir as an input 
parameter. 

> On Jan 29, 2014, at 11:04 PM, Andrew <[email protected]> wrote:
> 
> So ...
> I am tasked with managing ssh keys for which I want to use puppet to do the 
> deployment.
> I dont know ahead of time which users will using/assigned keys so, my 
> question is.
> 
> how to determine the homedir of any user? is there a variable present with 
> this info without resorting to an exec?
> 
> Not all users have /home/$USER homedirs, (eg apache=/var/www, 
> puppet=/var/lib/puppet), 
> 
> I need to create a .ssh dir in the users homedir and copy some private keys 
> in there. 
> The authorized_keys type includes a user property, so the public key is easy.
> 
> kinda stumped ...
> Any ideas?
> 
> Thanks in advance.
> 
> Regards,
> Andrew
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/1944e04e-e98c-4cb6-8e3f-e470c88ce6ad%40googlegroups.com.
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/27CDF540-7049-4CD7-BE43-2EBF263CC2E0%40icloud.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to