Ubuntu client auto-join AD domain



I’m curious - has anyone put in place a script to auto-join Ubuntu computers to a UCS domain? I have scripts which will do it with manual intervention (basically doing what it says in the guide) but there’s a couple of areas which make it tricky…

  1. You need to ssh into the UCS server as root to run the udm command. Don’t really want to have to add the root password to a script (can it be done via sudo and another user?)

  2. If a rebuild of a computer is being done, then the system needs to be removed from the UCS server first (or the add script modified to include the previously randomly generated password use for ldap.secret - which would then need to be pulled from the UCS ldap)

  3. If a computer has been added to UCS manually (in order to add it to DHCP as a static IP) then the LDAP password will not be set in /etc/ldap.secret as part oft he initial setup (to be fair, this should be fixable by some re-working of the use of the udm command)

Ideally, I’d like to be able to get to the point where an end user could decide to re-build their computer via PXE boot and end up with an Ubuntu system attached to the UCS domain…

So - rather than re-invent the wheel, I thought I’d ask if anyone has already done something similar?