Closed stuhay closed 3 years ago
Hi @stuhay
Your suggestion is valid. I suppose, the change can check for domain join status instead of string comparison.
Also, please take a look at https://github.com/aws/amazon-ssm-agent/blob/mainline/agent/plugins/domainjoin/domainjoin_unix_script.go#L629
if [ -z $KEEP_HOSTNAME ]; then
set_hostname
fi
This option is available only if the SSM Document AWS-JoinDirectoryServiceDomain adds an option.
Hi @smhmhmd
I agree, a check early on to see whether the domain has already been joined is more elegant.
The KEEP-HOSTNAME won't currently work for us as the DHCP option set gives an ugly (and probably non-compliant) initial name. We still wish to use the name provided by the plugin, we just don't want it to change if the plugin runs again for any reason.
Pull Request created https://github.com/aws/amazon-ssm-agent/pull/351
The script aws_domainjoin.sh is not 100% re-runnable.
It correctly determines that the domain is already joined and exists gracefully, but this is after it generates a new hostname and updates the operating system. This results in different hostname on the server to the machine name in Active Directory.
The following added to the set_hostname() function to be re-runnable:
We are hitting this problem because due to some odd setup we have a situation where the same instance has more than one SsmAssociation for domainJoin (the second is added when the instance joins a AutoScaling group and gets a new tag which is auto-associated).