To initialize a Windows machine, create infrastructure and cloud templates in vRealize Automation Cloud Assembly so that the initializable Windows image runs the commands that you want.
The example shown here is based on vSphere, but other cloud vendors should be similar.
- Create infrastructure. In vRealize Automation Cloud Assembly, add your vSphere cloud account and an associated cloud zone.
- Add flavor and image mappings, and add network and storage profiles.
In your infrastructure, an image mapping must point to the Windows template you created to support Cloudbase-Init. See How to create an initializable Windows image for vSphere.
If the template isn't listed, go to Cloud Accounts, and synchronize images. Otherwise, automatic synchronization runs every 24 hours.
- Add a project, add users, and make sure the users can provision to your cloud zone.
For more about creating infrastructure and projects, see the examples in the WordPress use case.
- In vRealize Automation Cloud Assembly, go to the Design tab, and create a new cloud template.
- Add a
cloudConfigsection with the Cloudbase-init commands that you want.
The following command examples create a new file at the Windows
C:drive and set the host name.
resources: Cloud_Machine_1: type: Cloud.Machine properties: image: cloudbase-init-win-2016 flavor: small remoteAccess: authentication: usernamePassword username: Administrator password: Password1234@$ cloudConfig: | #cloud-config write_files: content: Cloudbase-Init test path: C:\test.txt set_hostname: testname
For more information, see the Cloudbase-init documentation.
remoteAccessproperties so that you configure the machine for initial login to Windows.
As mentioned when you created the template, the metadata service picks up the login credentials and exposes them to CreateUserPlugin and SetUserPasswordPlugin. Note that the password must meet Windows password requirements.
- From vRealize Automation Cloud Assembly, test and deploy the cloud template.
- After deploying, use Windows RDP and the credentials in the template to log in to the new Windows machine and verify the customization.
In the example above, you would look for the
C:\test.txtfile, and check the system properties for the host name.