An image mapping groups a set of predefined target OS specifications for a specific cloud account/region in vRealize Automation Cloud by using natural language naming.

Cloud vendor accounts such as Microsoft Azure and Amazon Web Services use images to group a set of target deployment conditions together, including OS and related configuration settings. vCenter and NSX-based environments, including VMware Cloud on AWS, use a similar grouping mechanism to define a set of OS deployment conditions. When you build and eventually deploy and iterate a cloud template, you pick an available image that best fits your needs.

Organize image mappings for a project by similar operating system settings, tagging strategy, and functional deployment intent.

For an example of how to define a basic image mapping, see Add image mappings.

To simplify cloud template creation, you can select a pre-configuration option when you add a new cloud account. When you select the pre-configuration option, your organization's most popular flavor mapping and image mapping for the specified region are selected.

When you add image information to a cloud template, you use either the image or imageRef entry in the properties section of a machine component. For example, if you want to clone from a snapshot, use the imageRef property.

For examples of image and imageRef entries in cloud template code, see Designing your Cloud Assembly deployments.

To assign a permission on a content library, an administrator must grant the permission to the user as a global permission. For related information, see Hierarchical Inheritance of Permissions for Content Libraries in vSphere Virtual Machine Administration at VMware vSphere Documentation.

Synchronizing images for the cloud account/region

You can run image synchronization to ensure that the images you are adding or removing for a given cloud account/region on the Infrastructure > Configure > Image Mapping page are current.
  1. Open the associated Cloud Account/Region by selecting Infrastructure > Connections > Cloud accounts. Select the existing cloud account/region.
  2. Click the Sync Images button and let the action complete.

    picture of the Synchronize Image icon on the cloud account page

  3. When the action is complete, click Infrastructure > Configure > Image Mapping. Define a new or edit an existing image mapping and select the cloud account/region from step 1.
  4. Click the image synchronization icon on the Image Mapping page.

    image synchronization icon shown on Image Mappings page

  5. Configure image mappings settings for the specified cloud account/region on the Image Mapping page.

Viewing OVF details

You can include OVF specifications in Cloud Assembly cloud template objects, such as vCenter machine components and image maps. If your image contains an OVF file, you can discover its content without opening the file. Hover over the OVF to display OVF details, including its name and location. For more information about the OVF file format, see vcenter ovf: property.

hover over the View OVF Details symbol and click to see the OVF contents

Using constraints and tags to refine image selection

To further refine image selection in a cloud template, you can add one or more constraints to specify tag-based restrictions on the type of image that can be deployed. The supplied Constraints example that is displayed when you are creating or editing an image mapping configuration is !license:none:hard. The example illustrates a tag-based restriction where the image can only be used if the license:none tag is not present in the cloud template. If you add tags such as license:88 and license:92, the specified image can be used only if the license:88 and the license:92 tags are present in the cloud template.

picture of the image Mapping constraints example discussed above

Using a cloud configuration script to control deployment

You can use a cloud configuration script in an image map, cloud template, or both to define custom OS characteristics to be used in a Cloud Assembly deployment. For example, based on whether you are deploying a cloud template to a public or private cloud, you can apply specific user permissions, OS permissions, or other conditions to the image. A cloud configuration script adheres to a cloud-init format for Linux-based images or a cloudbase-init format for Windows-based images. Cloud Assembly supports the cloud-init tool for Linux systems and the cloudbase-init tool for Windows.

For Windows machines, you can use any cloud configuration script format that is supported by cloudbase-init.

The machine resource in the following sample cloud template code uses an image that contains a cloud configuration script, the content of which is seen in the image entry.
    type: Cloud.vSphere.Machine
      flavor: small
      image: MyUbuntu16
      cloudConfig: |
        ssh_pwauth: yes
          list: |
          expire: false
          - default
          - name: ${input.username}
            lock_passwd: false
            sudo: ['ALL=(ALL) NOPASSWD:ALL']
            groups: [wheel, sudo, admin]
            shell: '/bin/bash'
          - echo "Defaults:${input.username}  !requiretty" >> /etc/sudoers.d/${input.username}

What happens when an image mapping and a cloud template contain a cloud configuration script

When a cloud template that contains a cloud configuration script uses an image mapping that contains a cloud configuration script, both scripts are combined. The merge action processes the contents of the image mapping script first and the contents of the cloud template script second, with consideration being given to whether the scripts are in #cloud-config format or not.

  • For scripts that are in the #cloud-config format, the merge combines the contents of each module (for example runcmd, users, and write_files) as follows:
    • For modules where the contents are a list, the lists of commands from the image mapping and from the cloud template are merged, excluding commands that are identical in both lists.
    • For modules where the contents are a dictionary, the commands are merged and the result is a combination of both dictionaries. If the same key exists in both dictionaries, the key from the image mapping script dictionary is preserved and the key from the cloud template script dictionary is ignored.
    • For modules where the contents are a string, the content values from the image mapping script are kept and the content values from the cloud template script are ignored.
  • For scripts that are in a format other than #cloud-config or when one script is in #cloud-config format and the other is not, both scripts are combined in a way that the image mapping script is run first and the cloud template script is run when the image mapping script is finished.

For related information, see Merging user-data sections.

More information about configuring and using cloud configuration scripts

To configure cloud-init for Windows deployments in Cloud Assembly, see How do I set up a Windows template image with cloud-init or cloudbase-init in vRealize Automation Cloud.

For more information about using cloud configuration scripts, see How to automatically initialize a machine in a Cloud Assembly template.

Also see VMware blogger articles vSphere Customization with Cloud-init While Using vRealize Automation 8 or Cloud and Customizing Cloud Assembly Deployments with Cloud-Init.