You can use the ACS::Template action to embed a template into another template as a child template.
Description
The ACS::Template action can be used to embed a template into another template as a child template. You can use this action to modularize a complex template and split the template into multiple child templates for calling. You can also define common O&M operations as reusable child templates. In addition, CloudOps Orchestration Service (OOS) provides cloud product actions as the operation templates of common cloud services. You can embed these templates in your template.
Syntax
Embed a created template by using the template name
General format (applicable to all templates that can be embedded)
Tasks: - Name: callChildTemplate1 Action: ACS::Template Properties: TemplateName: child_template_name # Required. The name of the child template. TemplateVersion: v2 # Optional. By default, the latest version is used. Parameters: # Optional. The parameters that are required for executing the child template. ParameterName1: value1
{ "Tasks": [ { "Name": "callChildTemplate1", "Action": "ACS::Template", "Properties": { "TemplateName": "child_template_name", "TemplateVersion": "v2", "Parameters": { "ParameterName1": "value1" } } } ] }
Simplified format (applicable only to cloud product actions)
Tasks: - Name: taskName # Required. The name of the task. Example: runMyInstances. Action: CloudProductActionName1 # Required. The name of the cloud product action. Example: ACS::ECS::RunInstances. Properties: ParameterName1: value1 # Optional. The parameter that is required for executing the cloud product action. Example: ImageId.
{ "Tasks": [ { "Name": "taskName", "Action": "CloudProductActionName1", "Properties": { "ParameterName1": "parameterName1" } } ] }
Embed a new template by using the template content
Tasks:
- Name: callChildTemplate1
Action: ACS::Template
Properties:
TemplateContent:
FormatVersion: OOS-2019-06-01 # Required. The version of the template.
Parameters: # Optional. The parameters that are required for executing the child template.
Tasks: # Optional. The action that is performed by the child template.
{
"Tasks": [
{
"Name": "callChildTemplate1",
"Action": "ACS::Template",
"Properties": {
"TemplateContent": {
"FormatVersion": "OOS-2019-06-01",
"Parameters": null,
"Tasks": null
}
}
}
]
}
Limits
Embedding actions have the following limits:
A template cannot embed itself.
Loop embedding is not allowed. For example, A embeds B, B embeds C, and C embeds A.
The total number of embedding layers cannot exceed three.
The embedding of a cloud product action is regarded as one layer of embedding, and loop tasks cannot be considered as embedding.