# Tip: “Global” Template Variables

**URL:** <https://cylc.discourse.group/t/tip-global-template-variables/1357>\
**Category:** Tips\
**Created:** [October 26, 2026, 5:08pm UTC](https://cylc.discourse.group/t/tip-global-template-variables/1357 "2026-10-26T17:08:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliver.sanders](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/oliver.sanders/32/110_2.png) [@oliver.sanders](https://cylc.discourse.group/u/oliver.sanders)\
**Post date:** [October 26, 2026, 5:08pm UTC](https://cylc.discourse.group/t/tip-global-template-variables/1357/1 "2026-10-26T17:08:28Z")

</div>

Template variables, aka Jinja2 variables for use in the `flow.cylc` file, may now be configured in the `global.cylc` file for automatic use in all workflows.

The intention of this feature is to allow site-specific variables to be configured to facilitate workflow portability.

This has overlap with the [rose.conf[rose-stem]automatic-options=SITE](https://metomi.github.io/rose/doc/html/api/configuration/site-and-user.html#rose:conf:rose.conf%5Brose-stem%5Dautomatic-options "Opens in a new tab.") Rose configuration which sets a template variable called `SITE` for use in rose-stem test suites. We would encourage all sites using this configuration to create a new Cylc global template variable called `CYLC_SITE` set to the same value to facilitate rose-stem migration and site-portability. Note the `CYLC_` prefix avoids conflicts with existing workflow design patterns.

I.e, if you currently configure this:

```auto
# rose.conf

[rose-stem]
automatic-options=SITE=my-site

```

Then additionally configure this:

```auto
# global.cylc

[template variables]
    CYLC_SITE = "my-site"

```

The Cylc configuration is more generic as it can be used in all workflows (not just rose-stem suites). The Rose configuration remains supported and may be left in place for back-compatibility with rose-stem workflows running under Cylc 8.6 or until existing rose-stem workflows have migrated.

Rose-stem workflows will be encouraged to migrate from `SITE` to `CYLC_SITE` at some point in the future. Until then, for maximum portability, this Jinja2 snippet will use `CYLC_SITE` if defined, falling back to `SITE` if defined, falling back to `None`.

```auto
{% set CYLC_SITE = CYLC_SITE | default(SITE | default(None)) %}

```

> **Warning**
> 
> The `global.cylc[template variables]` configuration was only added in Cylc 8.7.0 and was not present in earlier versions of Cylc where it would cause errors if defined.
> 
> To configure this only for Cylc 8.7 (to avoid errors with older versions of Cylc) place the config in `<site-conf-path>/flow/8.7/global.cylc` (you may want to do the same for 8.8, etc, until 8.6 is retired).
> 
> For more information, see [`global.cylc`](https://cylc.github.io/cylc-doc/stable/html/reference/config/global.html#global.cylc "global.cylc") and `cylc config --print-hierarchy`.
