We're joining our Linux machines to our Active Directory using
adcli join. Now we start doing this as part of our saltstack setup, but we cannot figure out how to determine if the machine is already joined to the domain? It seems nothing breaks by doing multiple joins, but it does take some time and seems a bit unclean. What can we look at to find if the machine is already joined? Nothing in the
adcli suite seems to do the trick.
Linux distro used is CentOS (both 6.6 and 7), domain is 2008R2 functional level.
EDIT: I've seen some people checking for the existence of
/etc/krb5.keytab, but it seems to me that that is only indicative if the machine has ever been joined. If I remove the machine account from the AD, the file will still be there, but the machine is in fact no longer joined.