To request a deployment of a cloud template with contents inline, you use the Blueprint APIs to make a POST request with a project ID. Before requesting the deployment, you use the Deployment API to ensure that the deployment name does not already exist.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Automation Service Broker Deployment service have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that you have the ID for a project that is associated with the deployment that you are managing. See Request Deployment.
- Verify that the flavor mapping and image mapping specified in the cloud template to be deployed exist in your cloud account. See Create Flavor Mappings and Create Image Mappings.
- Verify that the cloud zone that you are deploying into is associated with your project. See Add a Cloud Zone to Your Project.
- Verify that a network profile is configured for the cloud account associated with the project. See Create Network Profiles.
- Assign an API version variable for the Blueprint API.
api_version_blueprint='2019-09-12'
Note: The Automation Service Broker Deployment service and the Automation Assembler Blueprint service have different API version values. You set the API version value for the Automation Service Broker Deployment service when you satisfied the general prerequisites.
Procedure
Example: Deploy a Cloud Template with Contents Inline
Request a deployment named Deployment with Cloud Template Contents Inline. When requesting the deployment, set image mapping set to ubuntu and flavor mapping set to small.
Assign variables.
$ url='https://api.mgmt.cloud.vmware.com' $ api_version='2020-08-25' $ api_version_blueprint='2019-09-12' $ project_id='394a4ccb-22c6-4ef0-8c75-8b77efbefb51' $ deployment_name="Deployment with Cloud Template Contents Inline"
To request deployment, you must assign image mapping and flavor mapping variables.
$ image_mapping='ubuntu' $ flavor_mapping='small'
Request deployment of a cloud template with contents inline.
$ curl -X POST \ $url/blueprint/api/blueprint-requests?apiVersion=$api_version_blueprint \ -H "Authorization: Bearer $access_token" \ -H 'Content-Type: application/json' \ -d '{ "deploymentName": "'"$deployment_name"'", "description": "requesting deployment with contents inline", "projectId": "'"$project_id"'", "inputs": { "flavor": "'"$flavor_mapping"'", "image" : "'"$image_mapping"'" }, "content" : "formatVersion: 1\ninputs:\n flavor:\n type: string\n title: Flavor\n description: Flavor Mapping Name\n image:\n type: string\n title: Image\n description: Image Mapping Name\nresources:\n cloud-vm:\n type: Cloud.AWS.EC2.Instance\n properties:\n name: cloudvm\n flavor: '\''${input.flavor}'\''\n image: '\''${input.image}'\''\n networks:\n - name: '\''${resource.Cloud_Network_1.name}'\''\n network: '\''${resource.Cloud_Network_1.id}'\''\n Provider_LoadBalancer_1:\n type: Cloud.LoadBalancer\n properties:\n name: OC-LB\n routes:\n - protocol: HTTP\n port: '\''80'\''\n instanceProtocol: HTTP\n instancePort: '\''80'\''\n healthCheckConfiguration:\n protocol: HTTP\n port: '\''80'\''\n urlPath: /index.html\n intervalSeconds: 60\n timeoutSeconds: 5\n unhealthyThreshold: 5\n healthyThreshold: 2\n network: '\''${resource.Cloud_Network_1.name}'\''\n instances:\n - '\''${resource[\"cloud-vm\"].id}'\''\n internetFacing: false\n Cloud_Network_1:\n type: Cloud.Network\n properties:\n name: provider\n networkType: public\n" }' | jq "."
A snippet of the response provides the cloud template request ID and the deployment ID.
... "type": "blueprint-request", "id": "bec37f54-3de5-451d-b484-a110c0ed8772", ... "projectId": "394a4ccb-22c6-4ef0-8c75-8b77efbefb51", "projectName": "example-project", "deploymentId": "5551a299-8b67-45e3-909e-a638d11b0d9f", "requestTrackerId": "bec37f54-3de5-451d-b484-a110c0ed8772", "deploymentName": "Deployment with Cloud Template Contents inline", ...
Assign the cloud template request ID.
$ cloud_template_request_id='bec37f54-3de5-451d-b484-a110c0ed8772'
Get the deployment status.
$ curl -X GET \ $url/blueprint/api/blueprint-requests/$cloud_template_request_id?apiVersion=$api_version_blueprint \ -H "Authorization: Bearer $access_token" | jq "."
A snippet of the response shows the deployment status.
... "inputs": { "image": "ubuntu", "flavor": "small" }, "status": "FINISHED", ...