Environments

Environment properties are defined as input parameters under the environments section in the composite template definition. The environments section usually includes default and environment.type sections.

environments/default

In the default section, you can specify the input parameters that apply to all environments defined in a composite template.

If an input parameter has a default value, you can use the default value or specify a user-defined value. If an input parameter does not have a default value, you must specify a user-defined value when applying the template. Use the following format to specify a value for a parameter:

paramName: paramValue

Parameter values can include references to other existing parameters with the following syntax:

paramName: ${otherParamName}

Example

In the following example, “param1” has a default value that you can use or replace. “param2” is a required parameter and you must provide a value for this parameter when applying the composite template. “param3” uses the values of “param1” and “param2” by reference.

environments:        
    default:        
      param1:  default        
      param2:  ${} 
      param3:  ${param1},${param2}    

Parameter values can include references to an existing credentials alias for a username or password using the following syntax:

paramName: ${@credentials.credentialsAlias.username}
paramName: ${@credentials.credentialsAlias.password}

You can use this 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.

Example

In the following example the @credentials. notation indicates that Command Central should use the username and password that match the ADMINISTRATOR credentials alias defined for the Platform Manager node.

environments:        
    default:         
      spm.username:  ${@credentials.ADMINISTRATOR.username}
      spm.password:  ${@credentials.ADMINISTRATOR.password}      

environments/environment.type

You can specify a type for each environment defined in a composite template in the implicit environment.type parameter. In the environment.type sections, you can either introduce new parameters (with default or custom values), or specify new values for parameters defined in the environments/default section.

Use the environment.type sections when you want to customize the list of input parameters and their values to fit the requirements of a particular environment type. The parameters and values you specify in an environment.type section apply only for that environment.

Note that when you specify a default value for a parameter in the environments/default section, the environment type sections use that default value, unless you specify a different default value for the same parameter in an environment.type section.

When using a composite template for migration, you can add the migration registry clean-up parameters listed in the following example in an environments/environment.type section.

environments:
  default:
  env.type:
    migration.pre.cleanup: true|false   # Optional. When set to true, Command Central cleans up
                                        # the migration registry before executing the template.
    migration.post.cleanup: true|false  # Optional. When set to true, Command Central cleans up
                                        # the migration registry after executing the template.
  

When the parameters are not set or their value is false, Command Central automatically cleans up the migration registry 60 hours after a successful template execution. You can also specify these parameters as arguments of the sagcc apply composite templates command.

How Command Central Processes Input Parameters

The values provided for the input parameters are resolved in the following order:
  1. The values from the environments/default section if this section exists
  2. The values from the environments/environment.type sections
  3. The user-defined values
  4. If an input parameter does not have a value, Command Central returns an error.

Example:

environments:    
  default 
    param1: defaultValue    
    param2:    
    param3: ${param1},${param2} 
    param4: anotherValue 
  envType1: 
    param2: someValue 
  envType2: 
    param1: v1 
    param3: v3

The following table describes the how the parameter values in this example are resolved:

Parameters Resolved Parameter Values
no parameters Error. Missing parameter values.

Provide values for the parameters.

param2=foo

param1=defaultValue

param2=foo

param3=defaultValue,foo

param4=anotherValue

environment.type=envType1

param1=defaultValue

param2=someValue

param3=defaultValue,someValue

param4=anotherValue

environment.type=envType2

param2=foo

param4=${param2}

param1=v1

param2=foo

param3=v3

param4=foo

environment.type=bar

Error. The template does not include an environment.type with value “bar”.

Either provide a valid value for environment.type or leave empty to use the global default values.

param2=foo

param5=bar

param1=defaultValue

param2=foo

param3=defaultValue,foo

param4=anotherValue

param5=bar

Note: The value for param5 is not used in the template and is ignored.