1 | initial version |
Cloudbase-Init has actions performed at various stages (called plugins). The one that sets the hostname (and needs a reboot because that's what Windows requires unfortunately) comes before the userdata or the localscripts ones.
If you are using OpenStack, I would recommend to pass a userdata PowerShell script that joins the domain, e.g. using djoin.exe:
#ps1
& djoin.exe /requestODJ /loadfile <blob_txt_file> /windowspath $ENV:SystemRoot /localos