For Cloud Assembly to initialize a Windows machine deployed to vSphere, the image needs to be based on a vSphere template with Cloudbase-Init installed and configured.
Creating the image
- Use vSphere to make and power on a Windows virtual machine.
- On the virtual machine, log in to Windows.
- Download Cloudbase-Init.
- Start the Cloudbase-Init setup .msi file.
During installation, enter Administrator as the username, and select the option to run as LocalSystem.
Other setup selections can remain as default values.
- Allow the installation to run, but do not close the final Completed page of the setup wizard.
Important: Do not close the final page of the setup wizard.
- With the Completed page of the setup wizard still open, use Windows to navigate to the Cloudbase-Init installation path, and open the following file in a text editor.
conf\cloudbase-init-unattend.conf
- Set
metadata_services
toOvfService
as shown. Add the setting if it doesn't already exist.metadata_services=cloudbaseinit.metadata.services.ovfservice.OvfService
- Save and close
cloudbase-init-unattend.conf
. - In the same folder, open the following file in a text editor.
conf\cloudbase-init.conf
- Set
first_logon_behaviour
,metadata_services
, andplugins
as shown. Add the settings if they don't already exist.first_logon_behaviour=always . . . metadata_services=cloudbaseinit.metadata.services.ovfservice.OvfService . . . plugins=cloudbaseinit.plugins.windows.createuser.CreateUserPlugin,cloudbaseinit.plugins.windows.setuserpassword.SetUserPasswordPlugin,cloudbaseinit.plugins.common.sshpublickeys.SetUserSSHPublicKeysPlugin,cloudbaseinit.plugins.common.userdata.UserDataPlugin . . .
- Save and close
cloudbase-init.conf
. - On the Completed page of the setup wizard, select the options to run Sysprep and to shut down after Sysprep, then click Finish.
Note: VMware has seen cases where running Sysprep prevents deployments of the image from working.
When deploying, Cloud Assembly applies a dynamically generated customization specification, which disconnects the network interface. The pending Sysprep state in the image might cause the customization specification to fail and leave the deployment disconnected.
If you suspect that this is happening in your environment, try leaving the Sysprep options deactivated when creating the image. - After the virtual machine shuts down, use vSphere to turn it into a template.
Additional details
The following table expands upon the configuration entries made during setup.
Configuration Setting | Purpose |
---|---|
Username, CreateUserPlugin, and SetUserPasswordPlugin | After Sysprep, first boot uses CreateUserPlugin to create the username Administrator account with a blank password. SetUserPasswordPlugin allows Cloudbase-Init to change the blank password to the remote access password that will be included in the cloud template. |
First Logon Behavior | This setting prompts the user to change the password upon first login. |
Metadata services | By listing only OvfService, Cloudbase-Init won’t try to find other metadata services that aren't supported in vCenter. This results in cleaner log files, because the logs would otherwise fill with entries about failing to find those other services. |
Plugins | By listing only plugins with capabilities supported by OvfService, logs are again cleaner. Cloudbase-Init runs plugins in the order specified. |
Run as LocalSystem | This setting supports any advanced initialization commands that might require Cloudbase-Init to run under a dedicated administrator account. |