Browse Source

Factorize minion grains generation

pull/35/head
Swann Croiset 7 years ago
parent
commit
7d792fe76f
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      salt/files/minion.conf

+ 5
- 5
salt/files/minion.conf View File



id: {{ system.name }}.{{ system.domain }} id: {{ system.name }}.{{ system.domain }}


{%- set excluded_keys = ('master', 'system', 'public_keys', 'private_keys', 'known_hosts', '__reclass__', '_secret', '_param') %}

grains: grains:
{%- if minion.get('manage_roles', True) %} {%- if minion.get('manage_roles', True) %}
roles: roles:
{%- for key, value in pillar.items() %} {%- for key, value in pillar.items() %}
{%- if key != 'master' and key != 'system' and key != 'public_keys' and key != 'private_keys' and key != 'known_hosts' and key != '__reclass__' and key != '_secret' and key != '_param' %}
{%- if key not in excluded_keys %}
{%- for subkey, subvalue in value.iteritems() %} {%- for subkey, subvalue in value.iteritems() %}
{%- if subvalue.enabled is defined %}
{%- if subvalue.enabled %}
{%- if subvalue.enabled is defined and subvalue.enabled %}
- {{key}}.{{ subkey }} - {{key}}.{{ subkey }}
{%- endif %} {%- endif %}
{%- endif %}
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- endif %} {%- endif %}
services: services:
{%- for key, value in pillar.items() %} {%- for key, value in pillar.items() %}
{%- if key != 'master' and key != 'system' and key != 'public_keys' and key != 'private_keys' and key != 'known_hosts' and key != '__reclass__' and key != '_secret' and key != '_param' %}
{%- if key not in excluded_keys %}
- {{key}} - {{key}}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}

Loading…
Cancel
Save