To run Windows machine initialization at deployment time, add Cloudbase-Init commands to the Automation Assembler template code.

The example shown here is based on vSphere, but other cloud vendors should be similar.

Prerequisites

  • Create infrastructure. In Automation Assembler, 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 a Windows template that you created to support Cloudbase-Init. See Windows Automation Assembler 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.

Procedure

  1. In Automation Assembler, go to the Design tab, and create a new cloud template.
  2. Add a cloudConfig section 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.

  3. Add remoteAccess properties 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.

  4. From Automation Assembler, test and deploy the cloud template.
  5. 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.txt file, and check the system properties for the host name.