I've been brainstorming effective methods to configure a puppet client (CentOS) to use LDAP authentication, but I haven't seen much in the CentOS/Puppet canon. The closest I've seen is Automated configuration of ldap authentication for RHEL5 servers but it appears that this will break with RHEL 6. Moreover, it appears to be less than minor-version-agnostic i.e. you may wind up needing a different version of each config file for each monor version of the O.S. This raises the question:
Would the following be a reasonable method for puppet LDAP configuration?
- Add some default user "timtebow" to the LDAP server.
- Create ldap module.
- If "timtebow" exists, do nothing.
- If "timtebow" doesn't exist, configure the client for LDAP authentication using authconfig
The advantages to this solution are that if puppet authentication is broken for any reason (the system can't see "timtebow" even if all files are installed correctly), everything gets reconfigured via authconfig.
The crux of implementation seems to be the logic of determining whether or not "timtebow" exists on the puppet client, either via fact or puppet itself, and subsequently running the appropriate puppet operations.
I've come up with a fact that tests for an LDAP user like so:
Facter.add("timtebow_user") do
setcode do
system "/usr/bin/id timtebow >/dev/null 2>&1"
end
end