Command Central 10.15 | Using the Command Line Interface | Template Commands | sagcc exec templates composite apply
 
sagcc exec templates composite apply
Applies a composite template registered and available under the specified alias in a Command Central installation. After you run the apply composite templates command, Command Central validates the composite template as a first processing step. See the "Skipping Validation Checks" section in this topic for the arguments you can use to skip some of the template validation.
Syntax
*Command Central syntax:
*With input parameters:
sagcc exec templates composite apply template_alias  
environment.mode={provision|migration|migrate|maintenance} [environment.type=type ]
param1=v1 param2=v2 [param3=v3...paramn=vn] [options]
*With input properties file:
sagcc exec templates composite apply template_alias  
{--input | -i} filename.properties [options]
*Not supported on Platform Manager.
Arguments and Options
Argument or Option
Description
template_alias
Required. The alias for the template to apply. You can determine the template alias using the sagcc list templates composite command.

environment.mode={provision|migrate|migration|maintenance}
Optional for the provisioning operation, but required when migrating an environment. Indicates the type of operation the apply command will execute. Valid values:
*provision - installs a new environment
*migrate|migration - migrates an existing environment
*maintenance - installs only the fixes defined in the template. For example, you can use this mode to install a Database Component Configurator fix that contains database schema changes.
[environment.type=type]
Optional. Specify what type of environment you want to create. You must specify one of the environment types defined in the template_alias YAML file.

param1=v1 param2=v2 [param3=v3...paramn=vn]
Required. The input parameters declared in the template_alias YAML file.
{--input | -i} filename.properties
Required. A properties file that contains the input parameters declared in the template_alias YAML file.
[options]
Optional. The command allows all options supported by the Command Line Interface. For a description of the options, see Common Options.
Skipping Validation Checks
You can skip some parts of the template validation by setting the template parameters in the following table to true:
Argument or Option
Description
skip.runtime.validation=true
Does not validate the entire template.
skip.repo.conn.validation=true
Does not check the connection to the repositories and if the products and fixes defined in the template and their dependencies are available in the repositories.
skip.product.dep.validation=true
Does not check if the products and their dependencies are available in the product repositories.
skip.fix.dep.validation=true
Does not check if the fixes and their dependencies are available in the fix repositories.
Usage Note
*You can include both the param1=v1 param2=v2 [param3=v3...paramn=vn] argument and an input properties file in the same command. The values of the input parameters from the argument will override the values of the same parameters specified in the properties file.
*You can use the following syntax to specify the username or passsword for different sets of credentials, such as repository, OS user, or product credentials. Note that the credentials alias must exist in Command Central. For details about how to create a credentials alias, see sagcc add security credentials and Create Credentials Aliases.
paramName=@credentials.credentialsAlias.username
paramName=@credentials.credentialsAlias.password
*When applying a composite template on the local installation, Command Central and Platform Manager will restart and the apply composite template job does not show on the jobs list.
*If one of the target nodes defined in a composite template is the localhost node, Command Central does not get restarted during the composite template application on the local node.
*For details about how Command Central applies a database micro template or a composite template with a database layer, based on the value of the environment.mode argument, see Managing Database Components Using a Template.
*When you include the environment.mode=migrate parameter, the apply command migrates the environment, but does not create new product instances. The product instances get created by the product migration utilities as described in Upgrading Software AG Products.
*If a sub-job of the main composite template apply job fails, the failure of the sub-job might cause the main template apply job to fail with an ERROR.
*When executing the command by specifying an expected status value with the {--expected-value | -e} option, the CLI output contains a non-zero return code if the expected status value is not retrieved and a zero return code if the expected status is successfully retrieved.
*When executing the command by specifying an encrypted value in a password argument, enclose the value in \" to ensure that the encrypted value is in quotes when it is processed as the value of a password parameter in the template YAML file.
For example:
db.password=\"{AES/CBC/PKCS5Padding}{GMfxghcHuJNqO396i8iES1fyQ/vkh50tULOPJ79tC8Q=}{IGD7aiMTQ3e1c8NZGTkPuA==}ikPlsNWacjGil3c4e/KL8Q==\"
Examples When Executing on Command Central
*The composite template with alias “myTemplate” is already imported in a Command Central installation. The template provisions an environment with type “dev” and installs a Platform Manager with alias “dev2” and port “7292” in the specified installation directory:
sagcc exec templates composite apply myTemplate environment.type=dev  
spm.alias=dev2 spm.port=7292 install.dir=C:\dev\nodes\dev2
*To apply a template with alias “myTemplate”, which is already imported in a Command Central installation, using the input parameters specified in the “mydevenv.properties” file:
sagcc exec templates composite apply myTemplate -i mydevenv.properties
*The composite template with alias “myTemplate” does not include a migration section and uses default migration settings. The template is applied on the “is1” and “is3” hosts:
sagcc exec templates composite apply myTemplate environment.mode=migrate
hosts=[is1,is3]
Because “myTemplate” uses default migration settings, the apply command renames the source installation directory and applies the source ports and database defined in the template to the target environment.
*The “myTemplate” composite template uses default migration settings and is applied on the “is1” and “is3” hosts. The apply command migrates “myTemplate” from the “/opt/sag98” source directory to the “/opt/sag910” target installation directory:
sagcc exec templates composite apply myTemplate environment.mode=migrate 
hosts=[is1,is3] src.install.dir=/opt/sag98 install.dir=/opt/sag910
*The command applies a template with alias “myTemplate”, which is already imported in a Command Central installation, using the input parameters specified in the “env.properties” file. The command waits for Command Central to become online for 120 seconds and submits the apply template request, then starts monitoring the job. If Command Central gets restarted at some point in the apply template operation, the command waits for Command Central to come online for 120 seconds. If Command Central does not come online for 120 seconds, the job fails. If Command Central does come online withing 120 seconds, the command is resubmitted. The command fails if it is not executed within 3600 seconds, or 1 hour.
sagcc exec templates composite apply myTemplate --wait-for-cc 120 --sync-job
-w 3600 –e “DONE” -c 30 --retry 1 -i env.properties
*To avoid exposing the password in plain text, include the existing ADMINISTRATOR credentials alias that matches the password for the Platform Manager node as an argument in the command:
sagcc exec templates composite apply myTemplate
spm.password=@credentials.ADMINISTRATOR.password