Created
August 21, 2017 23:19
-
-
Save vtolstov/d4f77aaf6959eee8dec79545e472c814 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- set archs = {'amd64': 'x86_64', 'i386': 'x86_32'} %} | |
{%- set system = '-'.join([salt['grains.get']('os'), salt['grains.get']('osrelease').split('.', 1)[0], archs.get(salt['grains.get']('osarch'), salt['grains.get']('osarch'))]).lower() %} | |
{%- set hostname, domainname = grains['id'].split('.',1) %} | |
{%- set project = '_'.join(domainname.split('.')[-2:]) %} | |
{%- set environment = domainname.replace('.','_') %} | |
{%- set roles = salt['pillar.get']('roles', []) %} | |
{%- from "macros.jinja" import include with context %} | |
base: | |
'*': | |
{{ include("systems/{0}/common".format(system)) }} | |
{%- for role in roles %} | |
{{ include("systems/{0}/{1}".format(system, role)) }} | |
{%- endfor %} | |
{{ include("projects/{0}/common".format(project)) }} | |
{%- for role in roles %} | |
{{ include("projects/{0}/{1}".format(project, role)) }} | |
{%- endfor %} | |
{{ include("environments/{0}/common".format(environment)) }} | |
{%- for role in roles %} | |
{{ include("environments/{0}/{1}".format(environment, role)) }} | |
{%- endfor %} | |
{{ include("nodes/{0}/{1}".format(environment, hostname)) }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment