Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow non-default config settings in master.d/f_defaults.conf … #271

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions salt/files/master.d/f_defaults.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
{% set reserved_keys = ['master', 'minion', 'cloud', 'salt_cloud_certs', 'engines'] -%}
{% set cfg_salt = pillar.get('salt', {}) -%}
{% set cfg_master = cfg_salt.get('master', {}) -%}
{% set default_keys = [] -%}
{%- macro get_config(configname, default_value) -%}
{%- do default_keys.append(configname) %}
{%- if configname in cfg_master -%}
{{ configname }}: {{ cfg_master[configname]|json }}
{%- elif configname in cfg_salt and configname not in reserved_keys -%}
Expand Down Expand Up @@ -78,6 +80,7 @@
# "states", "returners", etc.
# Like 'extension_modules' but can take an array of paths
{% if 'module_dirs' in cfg_master -%}
{%- do default_keys.append('module_dirs') %}
module_dirs:
{%- for dir in cfg_master['module_dirs'] %}
- {{ dir}}
Expand Down Expand Up @@ -152,6 +155,7 @@ module_dirs:

# Only events returns matching tags in a whitelist
{% if 'event_return_whitelist' in cfg_master -%}
{%- do default_keys.append('event_return_whitelist') %}
event_return_whitelist:
{%- for event_return in cfg_master['event_return_whitelist'] %}
- {{ event_return }}
Expand All @@ -169,6 +173,7 @@ event_return_whitelist:

# Store all event returns _except_ the tags in a blacklist
{% if 'event_return_blacklist' in cfg_master -%}
{%- do default_keys.append('event_return_blacklist') %}
event_return_blacklist:
{%- for event_return in cfg_master['event_return_blacklist'] %}
- {{ event_return }}
Expand Down Expand Up @@ -328,6 +333,7 @@ event_return_blacklist:
# capabilities to non root users. By default this capability is completely
# disabled.
{% if 'client_acl' in cfg_master -%}
{%- do default_keys.append('client_acl') %}
client_acl:
{%- for name, user in cfg_master['client_acl']|dictsort %}
{{ name}}:
Expand Down Expand Up @@ -356,6 +362,7 @@ client_acl:
# running any commands. It would also blacklist any use of the "cmd"
# module. This is completely disabled by default.
{% if 'client_acl_blacklist' in cfg_master %}
{%- do default_keys.append('client_acl_blacklist') %}
client_acl_blacklist:
users:
{% for user in cfg_master['client_acl_blacklist'].get('users', []) %}
Expand Down Expand Up @@ -549,6 +556,7 @@ client_acl_blacklist:
#
#master_tops: {}
{% if 'master_tops' in cfg_master %}
{%- do default_keys.append('master_tops') %}
master_tops:
{%- for master in cfg_master['master_tops'] -%}
{%- if cfg_master['master_tops'][master] is string %}
Expand Down Expand Up @@ -641,6 +649,7 @@ master_tops:
# - /srv/salt/prod/states
#
{% if 'file_roots' in cfg_master -%}
{%- do default_keys.append('file_roots') %}
{{ file_roots(cfg_master['file_roots']) }}
{%- elif 'file_roots' in cfg_salt -%}
{{ file_roots(cfg_salt['file_roots']) }}
Expand Down Expand Up @@ -686,6 +695,7 @@ master_tops:
# and don't want all the '.svn' folders and content synced to your minions,
# you could set this to '/\.svn($|/)'. By default nothing is ignored.
{% if 'file_ignore_regex' in cfg_master %}
{%- do default_keys.append('file_ignore_regex') %}
file_ignore_regex:
{% for regex in cfg_master['file_ignore_regex'] %}
- {{ regex }}
Expand All @@ -706,6 +716,7 @@ file_ignore_regex:
# to file_ignore_regex above, but works on globs instead of regex. By default
# nothing is ignored.
{% if 'file_ignore_glob' in cfg_master %}
{%- do default_keys.append('file_ignore_glob') %}
file_ignore_glob:
{% for glob in cfg_master['file_ignore_glob'] %}
- {{ glob }}
Expand Down Expand Up @@ -738,6 +749,7 @@ file_ignore_glob:
# - git
# - roots
{% if 'fileserver_backend' in cfg_master -%}
{%- do default_keys.append('fileserver_backend') %}
fileserver_backend:
{%- for backend in cfg_master['fileserver_backend'] %}
- {{ backend }}
Expand Down Expand Up @@ -811,6 +823,7 @@ fileserver_backend:
# Note: file:// repos will be treated as a remote, so refs you want used must
# exist in that repo as *local* refs.
{% if 'gitfs_remotes' in cfg_master -%}
{%- do default_keys.append('gitfs_remotes') %}
gitfs_remotes:
{%- for remote in cfg_master['gitfs_remotes'] %}
{%- if remote is iterable and remote is not string %}
Expand Down Expand Up @@ -847,6 +860,7 @@ gitfs_remotes:
# The gitfs_env_whitelist and gitfs_env_blacklist parameters allow for greater
# control over which branches/tags are exposed as fileserver environments.
{% if 'gitfs_env_whitelist' in cfg_master -%}
{%- do default_keys.append('gitfs_env_whitelist') %}
gitfs_env_whitelist:
{%- for git_env in cfg_master['gitfs_env_whitelist'] %}
- {{ git_env }}
Expand All @@ -858,6 +872,7 @@ gitfs_env_whitelist:
{% endif %}

{% if 'gitfs_env_blacklist' in cfg_master -%}
{%- do default_keys.append('gitfs_env_blacklist') %}
gitfs_env_blacklist:
{%- for git_env in cfg_master['gitfs_env_blacklist'] %}
- {{ git_env }}
Expand Down Expand Up @@ -921,6 +936,7 @@ gitfs_env_blacklist:
# a top file and sls files. However, pillar data does not need to be in the
# highstate format, and is generally just key/value pairs.
{% if 'pillar_roots' in cfg_master -%}
{%- do default_keys.append('pillar_roots') %}
pillar_roots:
{%- for name, roots in cfg_master['pillar_roots']|dictsort %}
{{ name }}:
Expand All @@ -943,6 +959,7 @@ pillar_roots:
{%- endif %}

{% if 'ext_pillar' in cfg_master %}
{%- do default_keys.append('ext_pillar') %}
ext_pillar:
{%- for pillar in cfg_master['ext_pillar'] -%}
{%- for key in pillar -%}
Expand Down Expand Up @@ -1122,6 +1139,7 @@ ext_pillar:
# This is not recommended, since it would allow anyone who gets root on any
# single minion to instantly have root on all of the minions!
{% if 'peer' in cfg_master %}
{%- do default_keys.append('peer') %}
peer:
{% for name, roots in cfg_master['peer'].items() %}
{{ name }}:
Expand Down Expand Up @@ -1155,6 +1173,7 @@ peer:
# foo.example.com:
# - manage.up
{% if 'peer_run' in cfg_master %}
{%- do default_keys.append('peer_run') %}
peer_run:
{% for name, roots in cfg_master['peer_run'].items() %}
{{ name }}:
Expand Down Expand Up @@ -1185,6 +1204,7 @@ peer_run:
# data only, minions web* to get all network.* and disk.* mine data and all other
# minions won't get any mine data.
{% if 'mine_get' in cfg_master -%}
{%- do default_keys.append('mine_get') %}
mine_get:
{%- for minion, data in cfg_master['mine_get']|dictsort %}
{{ minion }}:
Expand Down Expand Up @@ -1268,6 +1288,7 @@ mine_get:
# 'salt.modules': 'debug'
#
{% if 'log_granular_levels' in cfg_master %}
{%- do default_keys.append('log_granular_levels') %}
log_granular_levels:
{% for name, lvl in cfg_master['log_granular_levels'].items() %}
{{ name }}: {{ lvl }}
Expand All @@ -1289,6 +1310,7 @@ log_granular_levels:
# group1: 'L@foo.domain.com,bar.domain.com,baz.domain.com and bl*.domain.com'
# group2: 'G@os:Debian and foo.domain.com'
{%- if 'nodegroups' in cfg_master %}
{%- do default_keys.append('nodegroups') %}
nodegroups:
{%- for name, lvl in cfg_master['nodegroups'].items() %}
{{ name }}: {{ lvl }}
Expand Down Expand Up @@ -1323,6 +1345,7 @@ nodegroups:

# List of git repositories to include with the local repo:
{% if 'winrepo_remotes_ng' in cfg_master %}
{%- do default_keys.append('winrepo_remotes_ng') %}
winrepo_remotes_ng:
{% for repo in cfg_master['winrepo_remotes_ng'] %}
- {{ repo }}
Expand All @@ -1347,6 +1370,7 @@ winrepo_remotes_ng:

# List of git repositories to include with the local repo:
{% if 'winrepo_remotes' in cfg_master %}
{%- do default_keys.append('winrepo_remotes') %}
winrepo_remotes:
{% for repo in cfg_master['winrepo_remotes'] %}
- {{ repo }}
Expand All @@ -1373,6 +1397,7 @@ winrepo_remotes:

# List of git repositories to include with the local repo:
{% if 'win_gitrepos' in cfg_master %}
{%- do default_keys.append('win_gitrepos') %}
win_gitrepos:
{% for repo in cfg_master['win_gitrepos'] %}
- {{ repo }}
Expand Down Expand Up @@ -1400,6 +1425,7 @@ win_gitrepos:
{{ get_config('event_match_type', 'startswith') }}

{%- if 'halite' in cfg_master %}
{%- do default_keys.append('halite') %}
##### Halite #####
##########################################
halite:
Expand All @@ -1409,6 +1435,7 @@ halite:
{%- endif %}

{%- if 'rest_cherrypy' in cfg_master %}
{%- do default_keys.append('rest_cherrypy') %}
##### rest_cherrypy #####
##########################################
rest_cherrypy:
Expand All @@ -1418,6 +1445,7 @@ rest_cherrypy:
{%- endif %}

{%- if 'rest_tornado' in cfg_master %}
{%- do default_keys.append('rest_tornado') %}
##### rest_tornado #####
###########################################
rest_tornado:
Expand All @@ -1433,6 +1461,7 @@ rest_tornado:
{%- endif %}

{%- if 'consul_config' in cfg_master %}
{%- do default_keys.append('consul_config') %}
##### consul_config #####
##########################################
consul_config:
Expand All @@ -1442,15 +1471,23 @@ consul_config:
{%- endif %}

{% if 'mongo' in cfg_master -%}
{%- do default_keys.append('mongo') %}
##### mongodb connection settings #####
##########################################
{%- for name, value in cfg_master['mongo'].items() %}
mongo.{{ name }}: {{ value }}
{%- endfor %}

{% if 'alternative.mongo' in cfg_master -%}
{%- do default_keys.append('alternative.mongo') %}
{%- for name, value in cfg_master['alternative.mongo'].items() %}
alternative.mongo.{{ name }}: {{ value }}
{%- endfor %}
{% endif %}
{%- endif %}

{%- for configname in cfg_master %}
{%- if configname not in reserved_keys and configname not in default_keys %}
{{ configname }}: {{ cfg_master[configname]|json }}
{%- endif %}
{%- endfor %}