Shopping cart

Subtotal:

$0.00

HPE0-G05 Explain the role and function of Variable contexts, HPE Morpheus Enterprise Software variables overview, and Pre-provisioning variables

Explain the role and function of Variable contexts, HPE Morpheus Enterprise Software variables overview, and Pre-provisioning variables

Detailed list of HPE0-G05 knowledge points

Explain the role and function of Variable contexts, HPE Morpheus Enterprise Software variables overview, and Pre-provisioning variables Detailed Explanation

Variable Contexts

1. What “context” means

When we talk about variable contexts in Morpheus, we are describing where a variable comes from and when or where it can be used.

A “context” controls:

  • Visibility – which scripts, Workflows, or instances can see the variable

  • Scope – how long the variable lives

  • Priority – which variable wins if multiple variables have the same name

Morpheus uses many layers of context. Common examples include:

  • Global / appliance context
    System-wide variables available across the entire Morpheus appliance.

  • Tenant context
    Variables assigned per tenant (useful in MSP or shared environments).

  • Group / Cloud context
    Variables tied to a specific group or cloud, such as region names, network defaults, etc.

  • Blueprint / App context
    Variables defined at the application or blueprint level and shared among its tiers.

  • Instance / Container / VM context
    Variables specific to a single instance or VM, such as hostname, IP, instance ID.

  • Workflow / Task context
    Variables created at runtime inside a Workflow or Task, often used temporarily.

  • User / Role context
    Variables coming from user Inputs or assigned to roles.

Each of these contexts has its own role in determining how variables flow through automation.

2. Typical variable scopes

Global / System variables

These are automatically provided by Morpheus. Examples include:

  • appliance URL

  • timestamps

  • system identifiers

  • global environment metadata

They are always available unless overridden by a more specific context.

Cloud / Group variables

These belong to a specific cloud or group configuration. Examples:

  • default region

  • network/subnet information

  • cloud-specific metadata

  • sizing/policy defaults

Used heavily for multi-cloud or multi-datacenter deployments.

Instance variables

Every instance or VM has its own set of variables, such as:

  • hostname

  • private/public IP

  • instance ID

  • plan / size

  • attached tags

These variables are crucial for scripts that run on or configure individual instances.

App / Blueprint variables

In multi-tier applications:

  • variables defined at the App level are shared by all tiers

  • Blueprint-level variables help coordinate values like version numbers or environment codes

Workflow / Task variables

These are temporary values created when a Workflow or Task executes.

Example:

  • A Task might compute a value and store it in ${task.customValue}

  • A Workflow might define variables that later Tasks can use

User Inputs

Values provided by the user through forms.

Examples:

  • environment (dev/test/prod)

  • application code

  • region

  • OS type

These become variables such as ${input.environment} and are used heavily during pre-provisioning.

3. Precedence and resolution

When two variables have the same name in different contexts, Morpheus follows a priority hierarchy.
More specific contexts override more general ones.

Conceptual resolution order:

  1. Task-level / Workflow-level variables
    (most specific — highest priority)

  2. Instance / App-level variables

  3. Group / Cloud-level variables

  4. Global variables
    (least specific — lowest priority)

This means:

  • A Workflow variable overrides an Instance variable.

  • An Instance variable overrides a Cloud variable.

  • A Cloud variable overrides a Global variable.

Understanding precedence ensures you don’t accidentally use the wrong value.

HPE Morpheus Variables Overview

1. Types of variables

System (built-in) variables

Morpheus automatically provides many variables. Examples:

  • ${instance.name}

  • ${instance.id}

  • ${instance.ip}

  • ${cloud.name}

  • ${group.name}

  • ${tenant.name}

These values come from the system and require no user configuration.

Custom variables

Defined through:

  • Inputs

  • Blueprints

  • Workflows

  • Tasks

  • Policies

These allow you to tailor behavior for different environments or applications.

Secret variables

Values stored in Cypher but accessed like normal variables:

Example:

${cypher:/secrets/mysqlPassword}  

These are used for:

  • passwords

  • API keys

  • certificates

  • tokens

Metadata / Tags

Metadata and tags attached to:

  • instances

  • clouds

  • groups

  • apps

can often be referenced as variables.

These are extremely useful for automation rules and naming conventions.

2. Where variables are used

Variables appear in almost every Morpheus automation component, including:

  • Script Templates and Tasks

  • File Templates

  • Blueprint definitions

  • Workflows (all phases)

  • Option Lists

  • Request scripts

  • Any location that supports variable interpolation

Variables make automation dynamic and flexible.

3. Variable syntax usage (conceptual)

Examples in Scripts:

echo "Instance name: ${instance.name}"  
DB_PASS=${cypher:/secrets/mysqlPassword}  

Examples in YAML/JSON templates:

host: ${instance.privateIp}  
env: ${input.environment}  
apiKey: ${cypher:/api/secretKey}  

The syntax ${variable} is widely used, and Morpheus replaces these placeholders at runtime.

4. Security considerations

  • Sensitive variables should always be stored in Cypher, not in clear text.

  • Avoid printing secrets in scripts — they may appear in logs.

  • UI masking helps hide sensitive data, but secure storage is still essential.

  • Least privilege: only allow needed roles to view or use secrets.

Good security practices ensure your automation does not leak sensitive information.

Pre-provisioning Variables

1. What pre-provisioning variables are

Pre-provisioning variables are:

  • defined before Morpheus creates the instance or application

  • used to make critical decisions

They come from:

  • Inputs

  • Option Lists

  • Request scripts

  • Cloud/Group context

  • Policies and defaults

These variables shape how an instance gets created.

2. Why they matter

Pre-provisioning variables decide fundamental provisioning attributes, such as:

  • which cloud to deploy to

  • which region

  • which plan / VM size

  • which image / OS

  • which network / subnet

  • naming conventions (hostname, app name, resource group)

Because these values affect the creation process itself, they must be available before provisioning begins.

Example:

If you choose “Linux” in an Input field, Morpheus must know this before it selects the VM image.

3. How they are typically populated

Inputs

End users fill forms:

  • environment = dev / test / prod

  • location = us-east / eu-west

  • role = web / app / db

These become variables like:

  • ${input.environment}

  • ${input.location}

Option Lists

Dynamic or static lists that guide user selections:

  • available regions

  • VM sizes

  • application versions

Useful for standardization.

Request scripts

Scripts can:

  • validate inputs

  • fetch data from external systems

  • compute dynamic values

  • override defaults

Example:

{  
  "hostname": "web-${input.environment}-${timestamp}"  
}  
Policies / Defaults

Policies can predefine:

  • networks

  • naming rules

  • plans

  • placement logic

These values become available as variables.

4. Usage examples

Build a hostname
hostname = ${input.env}-${input.appCode}-${instance.sequence}  
OS choice
if input.osType == "Linux":  
    select Linux image  
else:  
    select Windows image  
Network selection
subnet = ${input.locationSubnet}  

These choices must be made before the VM or app is provisioned.

Explain the role and function of Variable contexts, HPE Morpheus Enterprise Software variables overview, and Pre-provisioning variables (Additional Content)

1. Variable Contexts

Variable resolution timing

Variables in Morpheus resolve at different stages of the provisioning lifecycle. Certain contexts are not available early in the process.

  • Pre-provision stage
    At this point, the instance does not yet exist. Variables such as instance ID, IP address, or hostname (unless computed ahead of time) cannot be resolved.

  • Provision stage
    More variables become available as infrastructure objects begin to form.

  • Post-provision stage
    Almost all instance-level variables resolve, because the system has full information.

  • Runtime (Workflow/Task execution)
    Temporary variables created during Tasks or Workflows may appear only in this phase.

Understanding which variables exist at each stage is essential to choosing correct logic within Scripts, File Templates, or Workflows.

Blueprint and App-level variable visibility

Variables defined at the App (Blueprint) level may not automatically propagate to all tiers unless explicitly referenced.
Conversely:

  • App-level variables → accessible at the entire application scope

  • Tier-level variables → restricted to the specific tier unless passed explicitly

This distinction matters in multi-tier deployments because visibility rules impact template rendering and workflow behavior.

Variable inheritance

Some variable contexts participate in hierarchical inheritance. Examples include:

  • Group → Instance
    Group-level variables act as defaults for any instance provisioned inside that group.

  • Cloud → Instance
    Cloud-level metadata may populate variables automatically during provisioning.

Lower-level contexts override higher-level contexts when variable names collide.

User/Role context with RBAC effects

User-specific or role-specific variables may be restricted by RBAC:

  • A role may allow usage of a variable but not visibility of its underlying value.

  • Variable values may differ depending on the authenticated user executing the workflow.

This affects Inputs, Tasks, and any logic relying on user-scoped metadata.

2. Variables Overview

Read-only built-in variables

Certain system-defined variables cannot be overridden. Examples include:

  • ${instance.id}

  • ${instance.createdBy}

  • ${cloud.name}

If a variable is read-only, attempts to overwrite the value within scripts or workflows will not modify the system’s internal representation.

Naming conventions and conflict avoidance

Variable naming follows standard best practices:

  • Use clear, unique names for custom variables

  • Avoid using names that collide with built-in system variables

  • Maintain consistent patterns (e.g., app_, env_, network_)

Conflicts across contexts (e.g., global vs. instance vs. input) may cause unexpected overrides.

Option List–driven variable behavior

Option Lists dynamically populate Inputs and can significantly influence later variable evaluation:

  • Input selections may be constrained by Option List values

  • These Input-driven variables feed into pre-provision logic

  • Dynamic Option Lists may produce variables based on API-returned data

This makes Option Lists an early-stage variable source.

String-only resolution in certain contexts

Not all variables evaluate as complex objects. In many contexts, variables resolve purely as strings:

  • Script Templates (shell/PowerShell) generally receive string values

  • Some JSON-based templates allow richer object support

  • File Templates often interpolate variables as literal strings

The context determines whether complex structures (arrays, objects) can be processed.

3. Pre-provisioning Variables

Variable categories not available during pre-provisioning

Some variables do not exist until later stages:

  • instance IP addresses

  • instance agent metadata

  • resource IDs

  • dynamically created cloud resource attributes

Pre-provisioning variables must rely on:

  • Inputs

  • Option Lists

  • Request Scripts

  • defaults and policies

  • cloud/group metadata

Anything requiring actual created infrastructure will not resolve.

Influence on policy evaluation

Pre-provisioning variables directly affect:

  • placement policies

  • cloud selection rules

  • plan/size restrictions

  • naming conventions

  • network selection

Policies often read these variables to validate compliance before provisioning begins.

Structured data from Request Scripts

Request Scripts may return:

  • simple key-value pairs

  • nested JSON structures

  • computed metadata

  • lookup results from external APIs

This is important for conditional provisioning logic where multiple attributes need to be passed forward.

Order of variable evaluation

Morpheus typically resolves pre-provisioning variables in this sequence:

  1. Inputs

  2. Option Lists (derived from Inputs or external sources)

  3. Request scripts (custom logic, external lookups, computed defaults)

  4. Policies and defaults (governance rules, naming conventions, placement preferences)

  5. Final variable resolution before provisioning

This ordered resolution ensures consistent and predictable outcomes during provisioning.

Impact on naming and metadata

Pre-provision variables influence early decision-making for:

  • hostname patterns

  • resource group names

  • tags and labels

  • application identifiers

  • cost-center metadata

These must resolve before instance creation so that infrastructure objects deploy with correct naming and tagging.

4. Miscellaneous but Relevant Additions

Template engine differences

Variable resolution differs depending on the template engine or component:

  • Script Templates: variables become environment variables or inline strings

  • File Templates: variables appear inside rendered configuration files

  • Blueprint template engines: may evaluate more complex structures

  • Tasks: variables may be substituted before script execution

Understanding engine-specific behavior is important when designing automation.

Multi-tenant considerations

Variables behave differently in multi-tenant environments:

  • tenants may have different variable scopes

  • tenant-specific metadata overrides global values

  • cross-tenant visibility is restricted by design

Variable conflicts may arise if naming is not tenant-aware.

System variables dependent on instance creation

Many system variables only exist after a resource has been created:

  • ${instance.ip}

  • ${instance.internalId}

  • ${instance.vmId}

  • ${instance.agentStatus}

Such variables cannot be used reliably in pre-provisioning logic and must be deferred to provisioning or post-provision phases.

Frequently Asked Questions

What is the purpose of variable contexts in Morpheus automation?

Answer:

Variable contexts define where variables originate and which automation components can access them.

Explanation:

In Morpheus, variables are organized into contexts that represent different objects in the platform—such as instances, servers, applications, and users. Each context exposes specific variables that automation tasks can reference. For example, an instance context may include variables like instance name, IP address, or environment. Script templates and file templates can access these variables using Morpheus variable syntax during provisioning. Variable contexts ensure automation tasks only access relevant data associated with the resource being deployed. A common mistake is assuming all variables are globally available, which can lead to scripts failing because the referenced variable exists in a different context.

Demand Score: 83

Exam Relevance Score: 88

How are variables typically referenced inside Morpheus script or file templates?

Answer:

Variables are referenced using Morpheus variable syntax that injects runtime values during execution.

Explanation:

Morpheus templates support variable substitution, allowing dynamic values to be inserted during provisioning. When a script or file template runs, the platform replaces variable placeholders with actual runtime values such as instance names, IP addresses, or user inputs. This allows templates to remain reusable across environments without hardcoding configuration details. For example, a configuration file template might dynamically insert the instance hostname or database connection string during deployment. A frequent mistake is attempting to define environment variables manually instead of using the built-in Morpheus variable system, which already provides access to deployment metadata.

Demand Score: 77

Exam Relevance Score: 85

What are pre-provisioning variables used for in Morpheus?

Answer:

Pre-provisioning variables provide input values that automation tasks can use before a resource is fully deployed.

Explanation:

Pre-provision variables are collected during the provisioning request process and made available to automation workflows before the instance or application is created. These variables often represent user inputs such as environment type, configuration options, or application parameters. Automation tasks can then use these values to influence provisioning behavior—for example selecting a configuration file, choosing a package version, or setting environment-specific settings. Because they exist before the resource is created, they are commonly used in pre-provision workflows to prepare infrastructure or configure dependencies.

Demand Score: 80

Exam Relevance Score: 87

Why might a variable referenced in a script template return an empty value during execution?

Answer:

The variable likely belongs to a different context or is not available at that stage of the workflow.

Explanation:

Variables in Morpheus are context-dependent and lifecycle-dependent. If a script references an instance attribute before the instance is fully created, the value may not yet exist. Similarly, referencing variables from a server context inside an application workflow may return empty values if the context is not available. Another common cause is using incorrect variable syntax or referencing variables that are only available in post-provision stages. Troubleshooting usually involves verifying the variable context and ensuring the script runs at the correct workflow stage.

Demand Score: 82

Exam Relevance Score: 90

Why are variables important for building reusable Morpheus automation templates?

Answer:

Variables allow templates to dynamically adapt to different deployments without modifying the template itself.

Explanation:

Reusable automation is one of Morpheus’s core design principles. By using variables instead of hardcoded values, administrators can use the same script or configuration template across many environments. For example, the same deployment template can install an application in development, staging, or production while using different hostnames, IP addresses, or credentials. Variables also allow user input to influence provisioning behavior, making deployments more flexible. Without variables, administrators would need to create separate templates for each environment, increasing maintenance complexity.

Demand Score: 76

Exam Relevance Score: 86

HPE0-G05 Training Course