Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can use Global Variables in your templates just as you can for scripts.  This allows for easy reusability of template just like scripts.  Perhaps we will have an Orchestration Script that will install a different software package depending on the environment.  We might create an Environment Scope Global Variable named {ENV_SPECIFIC_SCRIPT_URL} and reference that in our Orchestration configuration within the Farm Template:

Info

Note: Global Variables may currently only be used for fields that support Global Variables. (Noted with {X} in the Scalr UI) The Farm Template itself does not support Global Variables.

Code Block
{
    "_meta": {
        "schema_version": "v1beta0-7.4.0"
    },
    "farm": {
        "name": "Template with script URL GV",
        "description": "",
        "timezone": "America\/Denver",
        "launchOrder": "simultaneous"
    },
    "roles": [
        {
            "alias": "base-ubuntu1604-hvm",
            "platform": "ec2",
            "role": {
                "id": 82948
            },
            "scaling": {
                "enabled": true,
                "minInstances": 1,
                "maxInstances": 2,
                "scalingBehavior": "launch-terminate",
                "considerSuspendedServers": "running",
                "rules": []
            },
            "placement": {
                "region": "us-east-1",
                "placementConfigurationType": "AwsClassicPlacementConfiguration",
                "availabilityZones": null
            },
            "instance": {
                "instanceConfigurationType": "AwsInstanceConfiguration",
                "instanceType": {
                    "id": "m3.medium"
                }
            },
            "orchestration": {
                "rules": [
                    {
                        "trigger": {
                            "triggerType": "SpecificEventTrigger",
                            "event": {
                                "id": "BeforeHostUp"
                            }
                        },
                        "target": {
                            "targetType": "TriggeringServerTarget"
                        },
                        "action": {
                            "actionType": "UriAction",
                            "path": "https:\/\/{ENV_SPECIFIC_SCRIPT_URL}"
                        },
                        "timeout": 1200,
                        "runAs": "",
                        "order": 10,
                        "blocking": true
                    }
                ]
            }
        }
    ]
}

...