Browse Source

Merge pull request #271 from dafyddj/add-master-other-settings

allow non-default config settings in master.d/f_defaults.conf …
tags/v0.57.0
Forrest 8 years ago
parent
commit
f3f2251d75
1 changed files with 37 additions and 0 deletions
  1. +37
    -0
      salt/files/master.d/f_defaults.conf

+ 37
- 0
salt/files/master.d/f_defaults.conf View File

@@ -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 -%}
@@ -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}}
@@ -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 }}
@@ -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 }}
@@ -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}}:
@@ -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', []) %}
@@ -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 %}
@@ -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']) }}
@@ -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 }}
@@ -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 }}
@@ -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 }}
@@ -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 %}
@@ -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 }}
@@ -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 }}
@@ -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 }}:
@@ -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 -%}
@@ -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 }}:
@@ -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 }}:
@@ -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 }}:
@@ -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 }}
@@ -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 }}
@@ -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 }}
@@ -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 }}
@@ -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 }}
@@ -1400,6 +1425,7 @@ win_gitrepos:
{{ get_config('event_match_type', 'startswith') }}

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

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

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

{%- if 'consul_config' in cfg_master %}
{%- do default_keys.append('consul_config') %}
##### consul_config #####
##########################################
consul_config:
@@ -1442,6 +1471,7 @@ consul_config:
{%- endif %}

{% if 'mongo' in cfg_master -%}
{%- do default_keys.append('mongo') %}
##### mongodb connection settings #####
##########################################
{%- for name, value in cfg_master['mongo'].items() %}
@@ -1449,8 +1479,15 @@ 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 %}

Loading…
Cancel
Save