Ubuntu Autoinstall hostname is not set correctly before finish template execution
During the Ubuntu Autoinstall provisioning, the hostname of the new machine must be set before the finish template is applied. It is important because the subscription-manager register command, which is executed in the finish template, relies on the hostname.Unfortunately, due to the new Ubuntu Autoinstall mechanism, the hostname is not set correctly when the provisioning template is executed. A restart of the machine is necessary such that the hostname can be identified, but a restart is not an option since it needs further changes to switch the finish template execution after a restart.
Therefore, we must ensure that the hostname is set successfully, before the finish template got triggered. AFAIK, there would be two suitable solutions:
- Execute hostnamectl in the provisioning template, before the finish template is triggered
- Execute hostnamectl as first action in the finish template itself
It must be discussed, whether a change in the provisioning template or finish template should be preferred.