Cloud Services

Enterprise Marketplace

Deprovisioning stacks
Published On Jun 14, 2024 - 9:03 AM

Deprovisioning stacks

Describes how to delete any stack provisioned action supported by CAS for Ansible Tower.
To delete a stack on a previous or new provisioned order in your Enterprise Marketplace, you need to retire the existing action template and keep the same offering ID for publishing with the new action template.
The newly added action supports both the provisioning and de-provisioning using CAS.
After deleting the stack, if you want to identify whether the stack component is still present or not, use the Enterprise Marketplace inventory drill down view template. The view template is the one that provides the correct result.
Use the following setup as an example for deleting a stack. This payload must be done as part of the stack provisioning file. Note that the delete definition is inside the
otherActions
field:
{ "actionTemplate": { "ansibletower": { "provisioning": true, "jobTemplateId": "<provisioning ansible tower job template Id>", "outputResolver": [ { "returnType": "json", "correlationID": "{{<Task Name>::$..instance.vm_name}}_{{<TaskName>::$..instance.uuid}}", "resourceType": "vim.VirtualMachine", "additionalKeys": [ { "keyName": "uuid", "pattern": "{{<TaskName>::$..instance.uuid}}" } ] } ], "variables": [ { "name": "vm_name", "value": "functional(_configInfo){ if (_configInfo && _configInfo.vm_name){return_configInfo.vm_name} else {return '' }}(${_configINFO})" } ], //Define the delete SOI action inside the otherActions field. "otherActions": { // Place where other actions can be defined like deleting, and editing SOI. "delete": { "jobTemplateId": "<delete ansible tower job template Id>", "input": { // Define input variables mapping inside input tag "variables": [ // Varibles required by jobTemplateId/Playbook { "name": "uuid", "value": "function(r){p = r.trackingInfo.params;f = p.filter(a => a.correlationId);return f.length?f[0].correlationId:''}(${_resourceInfo})" } ] }, "output": {} // Define output variables mapping } } } } } }
  1. If there is not a stack component under the stack, then the stack can be deleted; even if the delete stack action is not defined under the catalog definitions.
  2. If there is a stack component under the stack, then the stack can only be deleted if the delete stack action is defined in the catalog definitions.
Do you have two minutes for a quick survey?
Take Survey