Bryan Horstmann-Allen <[email protected]> writes:

> I have used a simple fact to (very) naively determine "real" users. It runs on
> each client:
>
>   $ cat localusers.rb
>   Facter.add("localusers") do
>     setcode do
>       %x{USERS=`/bin/getent passwd | /bin/grep /home | /bin/awk -F: \'{print 
> $1}\'`; echo $USERS | sed -e \'s/ /,/g\'}.chomp

If you don't mind a couple of nits:

You probably want to note that this will collect users from, for example, NIS
or LDAP directories when run, not just "local" /etc/passwd users.  Different
people have different views on what "local" means in that case and I have been
caught by that before.

You can replace the grep, awk, echo, sed set with the more efficient:

    /bin/getent passwd | /bin/awk -F: '/\/home/ {printf $1 ","}'

Regards,
        Daniel

-- 
✣ Daniel Pittman            ✉ [email protected]            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to