jinja set dictionary variable

Host name pattern

{host-id}[.dev].{dc-id}.{domain}

Host name examples

h01.kyiv01.domain.com
h01.lon1.domain.com
vs02.lon2.domain.com
vs02.dev.lon1.domain.com
h01.ny01.domain.com

salt class with jinja for timezone definition

---
{%- set tz=dict() %}
{%- set _ = tz.update({'kyiv01':'Ukraine/Kiev'}) %}
{%- set _ = tz.update({'lon01':'Europe/London'}) %}
{%- set _ = tz.update({'lon02':'Europe/London'}) %}
{%- set _ = tz.update({'ny01':'America/New_York'}) %}

{%- set dc=__grains__['fqdn'].split('.')[-3].lower() %}

{%- if tz[dc] is defined %}
  {%- set timezone=tz[dc] %}
{%- else %}
  {%- set timezone='UTC' %}
{%- endif %}

pillars:
  linux:
    system:
      timezone: {{ timezone }}