An image mapping groups a set of predefined target operating system 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.

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 shared and latest images from a Microsoft Azure image gallery

When creating image mappings for Microsoft Azure, you can select images from a shared Azure image gallery in the subscription. The images in the drop-down menu are data-collected and made available based on your selected region.

While shared image galleries can be used across multiple subscriptions, they cannot be listed in the image mapping drop-down menu across subscriptions. Only the images of a particular subscription are data-collected and listed in the image mappings list. To use an image from an image gallery in a different subscription, provide the image ID in the image mapping and use that image mapping in the cloud template.

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.
resources:
  demo-machine:
    type: Cloud.vSphere.Machine
    properties:
      flavor: small
      image: MyUbuntu16 
        https://cloud-images.ubuntu.com/releases/16.04/release-20170307/ami-ubuntu-16.04-1.10.3-00-15269239.ova
      cloudConfig: |
        ssh_pwauth: yes
        chpasswd:
          list: |
            ${input.username}:${input.password}
          expire: false
        users:
          - default
          - name: ${input.username}
            lock_passwd: false
            sudo: ['ALL=(ALL) NOPASSWD:ALL']
            groups: [wheel, sudo, admin]
            shell: '/bin/bash'
        runcmd:
          - 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.

Add an image from a vCenter content library

When a local or publisher content library resides in a vCenter that is managed by your vRealize Automation Cloud organization, content library template images appear in the image drop-down menu. The images listed include OVF and VM template images in local or publisher vCenter content libraries. Images in subscriber content libraries do not appear in the drop-down menu. The template from which a VM has been cloned is shown in the machine details section of the machine deployments user interface.

Image shows a library item where the image name is prefaced by the library name and separated by a front slash character

Note:

If the publisher content library vCenter is managed by vRealize Automation Cloud, then publisher information is displayed in the image mapping selection grid in the following format: publisher_content_library_name / content_item_name

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.

If the publisher content library vCenter is not managed by vRealize Automation Cloud, then subscriber information is displayed in the image mapping selection grid in the following format: subscriber_content_library_name / content_item_name

When you deploy a cloud template that contains a VM template image mapping, vRealize Automation Cloud attempts to access the mapped image in the content library that is closest to the datastore, and then closest to the host, of the machine to be provisioned. This can include a local content library as well as a publisher or subscriber content library.

When you deploy a cloud template that contains an OVF template image mapping, OVF images are accessed as specified in the image mapping row if the image is in a local content library or a local subscriber of a specified remote publisher content library.

For related information about creating and using vCenter content libraries, see Using Content Libraries in vSphere product documentation and the How to Use Content Libraries in vRealize Automation 8 and vRealize Automation Cloud blog post.

More information about configuring and using cloud configuration scripts

For more information about working with cloud configuration scripts in cloud templates, see Machine initialization in Cloud Assembly .

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