Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _grains/map.jinja:
- # Using the hard coded from the salt-key name grain, grains['id'], for security
- {% set host_text, domain_text = salt['grains.get']('id').partition('.')[::2] %}
- {% set subdomain = salt['grains.get']('id').partition('.')[2].partition('.')[2] %}
- {% set host_list = host_text.split("-") %}
- {% set domain_list = domain_text.split(".") %}
- {% set host_items_count = host_list|length %}
- {% set domain_items_count = domain_list|length %}
- {% set subnet = salt['grains.get']('subnet_short') %}
- # Fallback plan
- {% if domain_list[-1] == 'consul' %}
- {% set component = host_list[0] %}
- {% set cluster = '' %}
- {% set role = host_list[0] %}
- {% set host_id = domain_list[0] %}
- {% set env = domain_list[1] %}
- {% set region = domain_list[3] %}
- {% else %}
- {% set component = host_list[0] %}
- {% set cluster = '' %}
- {% set role = '' %}
- {% set host_id = '' %}
- {% set host_combo = host_list[0] %}
- {% if host_items_count == 2 %}
- {% set component = host_list[0] %}
- {% set cluster = '' %}
- {% set role = '' %}
- {% set host_id = host_list[1] %}
- {% set host_combo = host_list[0] %}
- {% elif host_items_count == 3 %}
- {% set component = host_list[0] %}
- {% set cluster = host_list[1] %}
- {% set role = '' %}
- {% set host_id = host_list[2] %}
- {% set host_combo = host_list[0] + '-' + host_list[1] %}
- {% elif host_items_count == 4 %}
- {% set component = host_list[0] %}
- {% set cluster = host_list[1] %}
- {% set role = host_list[2] %}
- {% set host_id = host_list[3] %}
- {% set host_combo = host_list[0] + '-' + host_list[1] + '-' + host_list[2] %}
- {% elif host_items_count == 5 %}
- {% set component = host_list[0] %}
- {% set cluster = host_list[1] %}
- {% set role = host_list[2] %}
- {% set codename = host_list[3] %}
- {% set host_id = host_list[4] %}
- {% set host_combo = host_list[0] + '-' + host_list[1] + '-' + host_list[2] %}
- {% endif %}
- {% if domain_items_count >= 5 %}
- {% set env = domain_list[0] %}
- {% set region = domain_list[1] %}
- {% set provider = domain_list[2] %}
- {% endif %}
- {% endif %}
- {% set component_cluster = component + '-' + cluster %}
- {% set component_role = component + '-' + role %}
- {% set component_cluster_role = component + '-' + cluster + '-' + role %}
- {% set component_cluster_env = component + '-' + cluster + '-' + env %}
- {% set component_cluster_env_region = component + '-' + cluster + '-' + env + '-' + region %}
- {% set cluster_env_region = cluster + '-' + env + '-' + region %}
- pillars/top.sls
- {% import '_grains/map.jinja' as grain %}
- base:
- '*':
- - app_users
- - artifactory
- - global
- - accounts
- - saml
- - schedule
- {% if grain.account == 'development' %}
- - letsencrypt.{{ grain.account }}.common.aws
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement