On Thursday, June 14, 2012 8:31:23 AM UTC-5, Andy Botting
wrote:>
> My question is, can I lookup a value from an existing object in a similar
> way to this:
>
> $andy_home = $::role ? {
> special_case => ''/andy'',
> default => ''/home/andy'',
> }
>
> user { ''andy'':
> home => $andy_home,
> }
>
> $user_home = User[''andy''][''home'']
> notice("Andy''s home directory is: $user_home")
>
No, you cannot.
Custom facts are the standard mechanism for dynamically providing node
information to the master for use in catalog compilation. If you need
homedir locations only for specific, known users then you could create
custom facts for those homedirs. Actually, you could probably persuade
facter to generate such custom facts for all system users, but I would not
recommend that if any of your managed systems have very many users (even
systems that do not require this treatment).
Alternatively, if the homedirs are computable then you could rely on that
(i.e. $user = ''andy''; $user_home = "/home/${user}").
If none of that suffices then you need to tabulate the homedir locations
you need. Hiera might provide a good way for you to load the resulting
data into Puppet.
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/-/Hf_eO4pD_9wJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.