|
|
|
|
|
|
|
|
{% set reserved_keys = ['master', 'minion', 'cloud', 'salt_cloud_certs'] -%} |
|
|
{% set reserved_keys = ['master', 'minion', 'cloud', 'salt_cloud_certs'] -%} |
|
|
{% set cfg_salt = pillar.get('salt', {}) -%} |
|
|
{% set cfg_salt = pillar.get('salt', {}) -%} |
|
|
{% set cfg_minion = cfg_salt.get('minion', {}) -%} |
|
|
{% set cfg_minion = cfg_salt.get('minion', {}) -%} |
|
|
|
|
|
{% set default_keys = [] -%} |
|
|
{%- macro get_config(configname, default_value) -%} |
|
|
{%- macro get_config(configname, default_value) -%} |
|
|
|
|
|
{%- do default_keys.append(configname) %} |
|
|
{%- if configname in cfg_minion -%} |
|
|
{%- if configname in cfg_minion -%} |
|
|
{{ configname }}: {{ cfg_minion[configname]|json }} |
|
|
{{ configname }}: {{ cfg_minion[configname]|json }} |
|
|
{%- elif configname in cfg_salt and configname not in reserved_keys -%} |
|
|
{%- elif configname in cfg_salt and configname not in reserved_keys -%} |
|
|
|
|
|
|
|
|
# same machine but with different ids, this can be useful for salt compute |
|
|
# same machine but with different ids, this can be useful for salt compute |
|
|
# clusters. |
|
|
# clusters. |
|
|
{% if 'id' in cfg_minion -%} |
|
|
{% if 'id' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('id') %} |
|
|
id: {{ cfg_minion['id'] }} |
|
|
id: {{ cfg_minion['id'] }} |
|
|
{% else -%} |
|
|
{% else -%} |
|
|
#id: |
|
|
#id: |
|
|
|
|
|
|
|
|
{{ get_config('ping_interval', '0') }} |
|
|
{{ get_config('ping_interval', '0') }} |
|
|
|
|
|
|
|
|
{%- if 'mine_functions' in cfg_minion %} |
|
|
{%- if 'mine_functions' in cfg_minion %} |
|
|
|
|
|
{%- do default_keys.append('mine_functions') %} |
|
|
mine_functions: |
|
|
mine_functions: |
|
|
{%- for func, args in cfg_minion['mine_functions'].items() %} |
|
|
{%- for func, args in cfg_minion['mine_functions'].items() %} |
|
|
{{ func }}: {{ args }} |
|
|
{{ func }}: {{ args }} |
|
|
|
|
|
|
|
|
# |
|
|
# |
|
|
# Include a config file from some other path: |
|
|
# Include a config file from some other path: |
|
|
{% if 'include' in cfg_minion -%} |
|
|
{% if 'include' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('include') %} |
|
|
{% if isinstance(cfg_minion['include'], list) -%} |
|
|
{% if isinstance(cfg_minion['include'], list) -%} |
|
|
include: |
|
|
include: |
|
|
{% for include in cfg_minion['include'] -%} |
|
|
{% for include in cfg_minion['include'] -%} |
|
|
|
|
|
|
|
|
# - /srv/salt/prod/services |
|
|
# - /srv/salt/prod/services |
|
|
# - /srv/salt/prod/states |
|
|
# - /srv/salt/prod/states |
|
|
{% if 'file_roots' in cfg_minion -%} |
|
|
{% if 'file_roots' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('file_roots') %} |
|
|
{{ file_roots(cfg_minion['file_roots']) }} |
|
|
{{ file_roots(cfg_minion['file_roots']) }} |
|
|
{%- elif 'file_roots' in cfg_salt -%} |
|
|
{%- elif 'file_roots' in cfg_salt -%} |
|
|
{{ file_roots(cfg_salt['file_roots']) }} |
|
|
{{ file_roots(cfg_salt['file_roots']) }} |
|
|
|
|
|
|
|
|
# - git |
|
|
# - git |
|
|
# - roots |
|
|
# - roots |
|
|
{% if 'fileserver_backend' in cfg_minion -%} |
|
|
{% if 'fileserver_backend' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('fileserver_backend') %} |
|
|
fileserver_backend: |
|
|
fileserver_backend: |
|
|
{%- for backend in cfg_minion['fileserver_backend'] %} |
|
|
{%- for backend in cfg_minion['fileserver_backend'] %} |
|
|
- {{ backend }} |
|
|
- {{ backend }} |
|
|
|
|
|
|
|
|
# Note: file:// repos will be treated as a remote, so refs you want used must |
|
|
# Note: file:// repos will be treated as a remote, so refs you want used must |
|
|
# exist in that repo as *local* refs. |
|
|
# exist in that repo as *local* refs. |
|
|
{% if 'gitfs_remotes' in cfg_minion -%} |
|
|
{% if 'gitfs_remotes' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('gitfs_remotes') %} |
|
|
gitfs_remotes: |
|
|
gitfs_remotes: |
|
|
{%- for remote in cfg_minion['gitfs_remotes'] %} |
|
|
{%- for remote in cfg_minion['gitfs_remotes'] %} |
|
|
{%- if remote is iterable and remote is not string %} |
|
|
{%- if remote is iterable and remote is not string %} |
|
|
|
|
|
|
|
|
# The gitfs_env_whitelist and gitfs_env_blacklist parameters allow for greater |
|
|
# The gitfs_env_whitelist and gitfs_env_blacklist parameters allow for greater |
|
|
# control over which branches/tags are exposed as fileserver environments. |
|
|
# control over which branches/tags are exposed as fileserver environments. |
|
|
{% if 'gitfs_env_whitelist' in cfg_minion -%} |
|
|
{% if 'gitfs_env_whitelist' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('gitfs_env_whitelist') %} |
|
|
gitfs_env_whitelist: |
|
|
gitfs_env_whitelist: |
|
|
{%- for git_env in cfg_minion['gitfs_env_whitelist'] %} |
|
|
{%- for git_env in cfg_minion['gitfs_env_whitelist'] %} |
|
|
- {{ git_env }} |
|
|
- {{ git_env }} |
|
|
|
|
|
|
|
|
{% endif %} |
|
|
{% endif %} |
|
|
|
|
|
|
|
|
{% if 'gitfs_env_blacklist' in cfg_minion -%} |
|
|
{% if 'gitfs_env_blacklist' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('gitfs_env_blacklist') %} |
|
|
gitfs_env_blacklist: |
|
|
gitfs_env_blacklist: |
|
|
{%- for git_env in cfg_minion['gitfs_env_blacklist'] %} |
|
|
{%- for git_env in cfg_minion['gitfs_env_blacklist'] %} |
|
|
- {{ git_env }} |
|
|
- {{ git_env }} |
|
|
|
|
|
|
|
|
# this is the case, and pillar data is defined, then the pillar_roots need to |
|
|
# this is the case, and pillar data is defined, then the pillar_roots need to |
|
|
# also be configured on the minion: |
|
|
# also be configured on the minion: |
|
|
{% if 'pillar_roots' in cfg_minion -%} |
|
|
{% if 'pillar_roots' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('pillar_roots') %} |
|
|
pillar_roots: |
|
|
pillar_roots: |
|
|
{%- for name, roots in cfg_minion['pillar_roots']|dictsort %} |
|
|
{%- for name, roots in cfg_minion['pillar_roots']|dictsort %} |
|
|
{{ name }}: |
|
|
{{ name }}: |
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{% if 'ext_pillar' in cfg_minion %} |
|
|
{% if 'ext_pillar' in cfg_minion %} |
|
|
|
|
|
{%- do default_keys.append('ext_pillar') %} |
|
|
ext_pillar: |
|
|
ext_pillar: |
|
|
{%- for pillar in cfg_minion['ext_pillar'] -%} |
|
|
{%- for pillar in cfg_minion['ext_pillar'] -%} |
|
|
{%- for key in pillar -%} |
|
|
{%- for key in pillar -%} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{%- if 'module_config' in cfg_minion %} |
|
|
{%- if 'module_config' in cfg_minion %} |
|
|
|
|
|
{%- do default_keys.append('module_config') %} |
|
|
{%- for modkey, modval in cfg_minion.module_config.items() %} |
|
|
{%- for modkey, modval in cfg_minion.module_config.items() %} |
|
|
{{ modkey }}: {{ modval }} |
|
|
{{ modkey }}: {{ modval }} |
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
|
|
|
|
|
|
{{ get_config('event_match_type', 'startswith') }} |
|
|
{{ get_config('event_match_type', 'startswith') }} |
|
|
|
|
|
|
|
|
{% if 'mongo' in cfg_minion -%} |
|
|
{% if 'mongo' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('mongo') %} |
|
|
##### mongodb connection settings ##### |
|
|
##### mongodb connection settings ##### |
|
|
########################################## |
|
|
########################################## |
|
|
{%- for name, value in cfg_minion['mongo'].items() %} |
|
|
{%- for name, value in cfg_minion['mongo'].items() %} |
|
|
|
|
|
|
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
|
|
|
|
|
|
{% if 'alternative.mongo' in cfg_minion -%} |
|
|
{% if 'alternative.mongo' in cfg_minion -%} |
|
|
|
|
|
{%- do default_keys.append('alternative.mongo') %} |
|
|
{%- for name, value in cfg_minion['alternative.mongo'].items() %} |
|
|
{%- for name, value in cfg_minion['alternative.mongo'].items() %} |
|
|
alternative.mongo.{{ name }}: {{ value }} |
|
|
alternative.mongo.{{ name }}: {{ value }} |
|
|
{%- endfor %} |
|
|
{%- endfor %} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
|
|
|
{%- for configname in cfg_minion %} |
|
|
|
|
|
{%- if configname not in reserved_keys and configname not in default_keys %} |
|
|
|
|
|
{{ configname }}: {{ cfg_minion[configname]|json }} |
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
{%- endfor %} |