Open michaelsmoody opened 3 years ago
@anetheredge For you to review
@michaelsmoody Request for 4) to add an optional parameter to the SSM doc is queued, I will ask about 2) and 3)
Here is an example, as tested on Linux, see hostname regex as well in the script
{
"schemaVersion": "1.0",
"description": "Automatic Domain Join Configuration created by EC2 Console.",
"runtimeConfig": {
"aws:domainJoin": {
"properties": {
"directoryId": "d-xxxxxxx",
"directoryName": "[x.y.com](http://x.y.com/)",
"dnsIpAddresses": [
"A.B.C.D",
"E.F.G.H"
],
"hostName": "myhostname1234"
}
}
}
}
Hi I getting "An argument named "hostname" is not expected here." error for the above code
Hello,
I tested the script in Amazon Linux 2 and also with the latest SSM Agent 3.2.582.0, it works fine.
{
"schemaVersion": "1.0",
"description": "Automatic Domain Join Configuration created by EC2 Console.",
"runtimeConfig": {
"aws:domainJoin": {
"properties": {
"directoryId": "d-xxxxxxx",
"directoryName": "example.com",
"dnsIpAddresses": [
"a.b.c.d",
"e.f.g.h"
],
"hostName": "myhostname"
}
}
}
}
Thanks @suhailfouzan
@Chandra2108 I also tested same as above and the domain-join + host-rename worked fine. (AL2 in us-west-1)
Thanks @smhmhmd, @suhailfouzan. Working fine :)
Good afternoon to you all!
If you're in the USA (or outside of it, but observant), I hope you had a wonderful Thanksgiving!
Our organization has a few requests for enhancements to the seamless domain join for Linux/Unix instances that would make our lives tremendously easier:
I'll start (in this issue) with ones to the hostname setting. Specifically, this function:
https://github.com/aws/amazon-ssm-agent/blob/215d334a3d8204f37883399a5b81882b47951650/agent/plugins/domainjoin/domainjoin_unix_script.go#L60
(First, it's good work, it's well documented, and it's a clever approach).
Enhancements in no particular order
Move to 15 characters for random hostnames - While collisions are unlikely in the 6 character name space, 15 characters is the same amount that you would get with full IP addresses, with all octets filled and dots or dashes, for consistency. xxx.xxx.xxx.xxx for instance, same as 15 characters. It's mostly just a consistency suggestion. No other reason.
Allow the hostname to be overriden with a userdata variable. What this variable should be is up to you, but you already set REGION in another step via a curl call, so it's possible. Minor error checking to see if the variable is set, and then use the userdata supplied variable for hostname setting. Yes, there are cases where it wouldn't work (duplicates), in which case, a random name could be used, which would be a further enhancement, true.
Similar to a userdata variable, allow the hostname to overriden with an EC2 tag (again, what this tag name should be is up to you). This would be extraordinarily helpful as well.
Simply allow existing hostname to be obeyed and not set to a new random hostname. We set the hostname specifically, and having a random hostname set upon join is quite frustrating at times. There's no straightforward way to change it. We have to leave/join the domain again to change it. It would be far simple if we simply set the hostname to what we want, and this script would allow a variable, option, or userdata, to not mangle it, and join with the shortname/hostname already set.
Thank you again for the excellent work on this, and while helpful, these enhancements are requests. The most important one, if I had to choose would be either an override, or obey existing. Either of those two options. Yes, that might result in instances where the system didn't join (duplicates), but that could be reflected in the documentation as a real genuine risk.