|
- {%- from "salt/map.jinja" import master with context %}
- {%- from "linux/map.jinja" import system with context %}
-
- worker_threads: {{ master.worker_threads }}
- timeout: {{ master.command_timeout }}
-
- {%- if master.interface is defined %}
- interface: {{ master.interface }}
- {%- endif %}
- {%- if master.max_open_files is defined %}
- max_open_files: {{ master.max_open_files }}
- {%- endif %}
- {%- if master.pki_dir is defined %}
- pki_dir: {{ master.pki_dir }}
- {%- endif %}
- {%- if master.cachedir is defined %}
- cachedir: {{ master.cachedir }}
- {%- endif %}
-
- state_output: {{ master.get('state_output', 'changes') }}
-
- {%- if master.system is defined %}
-
- file_roots:
- base:
- - {{ master.dir.files }}/{{ master.system.environment }}
- {%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
- - {{ master.dir.files }}/{{ master.system.environment }}/{{ formula_name }}
- {%- endfor %}
- {{ master.system.environment }}:
- - {{ master.dir.files }}/{{ master.system.environment }}
- {%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
- - {{ master.dir.files }}/{{ master.system.environment }}/{{ formula_name }}
- {%- endfor %}
-
- {%- else %}
-
- file_roots:
- {%- for environment_name, environment in master.get('environment', {}).iteritems() %}
- {%- if master.base_environment == environment_name %}
- base:
- - {{ master.dir.files }}/{{ environment_name }}
- {%- endif %}
- {{ environment_name }}:
- - {{ master.dir.files }}/{{ environment_name }}
- {%- endfor %}
-
- {%- endif %}
-
- pillar_opts: False
-
- pillar_safe_render_error: {{ master.pillar_safe_render_error }}
-
- {%- if master.accept_policy == 'open_mode' %}
- open_mode: True
- {%- endif %}
-
- {%- if master.accept_policy == 'auto_accept' %}
- auto_accept: True
- {%- endif %}
-
- {%- if master.max_event_size is defined %}
- max_event_size: {{ master.max_event_size }}
- {%- endif %}
-
- {%- if master.pillar.engine == 'salt' %}
- pillar_roots:
- base:
- - {{ master.pillar.get('salt', {}).get('path', '/srv/salt/pillar') }}
- {%- endif %}
-
- {%- if master.pillar.engine == 'architect' %}
- ext_pillar:
- - cmd_yaml: 'architect-salt-pillar %s'
-
- master_tops:
- ext_nodes: architect-salt-top
- {%- endif %}
-
- {%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined) %}
-
- reclass: &reclass
- storage_type: {{ master.pillar.get('reclass', {}).get('storage_type', 'yaml_fs') }}
- inventory_base_uri: {{ master.pillar.get('reclass', {}).get('inventory_base_uri', '/srv/salt/reclass') }}
- {# Additional options, for backward compatibility salt:master:pillar might not be defined #}
- {%- if master.pillar.reclass is defined %}
- {%- if master.pillar.reclass.reclass_source_path is defined %}
- reclass_source_path: {{ master.pillar.reclass.reclass_source_path }}
- {%- endif %}
- {%- if master.pillar.reclass.get('class_mappings', [])|length > 0 %}
- class_mappings:
- {%- for mapping in master.pillar.reclass.class_mappings %}
- - {{ mapping.target }} {{ mapping.class }}
- {%- endfor %}
- {%- endif %}
- {%- if master.pillar.reclass.get('propagate_pillar_data_to_reclass', False) == True %}
- propagate_pillar_data_to_reclass: {{ master.pillar.reclass.propagate_pillar_data_to_reclass }}
- {%- endif %}
- # Below options are not available in original reclass,
- # use fork with extensions from https://github.com/salt-formulas/reclass
- {%- if master.pillar.reclass.get('ignore_class_notfound', False) == True %}
- ignore_class_notfound: {{ master.pillar.reclass.ignore_class_notfound }}
- ignore_class_regexp: {{ master.pillar.reclass.ignore_class_regexp }}
- {%- endif %}
- {%- if master.pillar.reclass.allow_scalar_over_dict is defined %}
- allow_scalar_over_dict: {{ master.pillar.reclass.allow_scalar_over_dict }}
- {%- endif %}
- {%- if master.pillar.reclass.allow_scalar_over_list is defined %}
- allow_scalar_over_list: {{ master.pillar.reclass.allow_scalar_over_list }}
- {%- endif %}
- {%- if master.pillar.reclass.allow_list_over_scalar is defined %}
- allow_list_over_scalar: {{ master.pillar.reclass.allow_list_over_scalar }}
- {%- endif %}
- {%- if master.pillar.reclass.allow_dict_over_scalar is defined %}
- allow_dict_over_scalar: {{ master.pillar.reclass.allow_dict_over_scalar }}
- {%- endif %}
- {%- if master.pillar.reclass.allow_none_override is defined %}
- allow_none_override: {{ master.pillar.reclass.allow_none_override }}
- {%- endif %}
- {%- endif %}
- {%- endif %}
-
- {%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}
-
- saltclass: &saltclass
- path: {{ master.pillar.saltclass.get('path', '/srv/salt/saltclass') }}
- {%- endif %}
-
-
- {%- if master.pillar.engine in ['composite', 'reclass'] %}
- {# generate indexed list of ext_engines #}
- {# NONE: Might be rewritten, once proved to work properly, with filters: #}
- {# NONE: select('mapping')|selectattr('_index')|sort(attribute='_index') #}
- {%- set ext_engines = {} %}
- {%- for name,engine in master.pillar.iteritems() %}
- {%- if not engine is mapping %}{% continue %}{% endif %}
- {%- do engine.update({'name': engine.get('name', name) }) %}
- {%- set index = engine.get('index', '1')~'-'~name %}
- {%- do ext_engines.update({ index: engine }) %}
- {%- endfor %}
- {%- if ext_engines|length > 0 or master.pillar.engine == "reclass" %}
-
- ext_pillar:
- {%- if master.pillar.engine == 'reclass' %}
- {#- too keep backward compatibility, in case master.pillar.reclass is not defied at all #}
- - reclass: *reclass
- {%- endif %}
- {%- for name, engine in ext_engines|dictsort %}
- {%- if master.pillar.engine == 'composite' and engine.name == 'reclass' %}
- - reclass: *reclass
- {%- endif %}
- {%- if engine.name == 'saltclass' %}
- - saltclass: *saltclass
- {%- endif %}
- {%- if engine.name == 'nacl' %}
- - nacl: {}
- {%- endif %}
- {%- if engine.name == 'gpg' %}
- - gpg: {}
- {%- endif %}
- {%- endfor %}
- {%- endif %}
- {%- endif %}
- {%- if master.ext_pillars is defined %}
- {%- for _, ext_pillar in master.ext_pillars.items() %}
- - {{ ext_pillar.module }}: {{ ext_pillar.params }}
- {%- endfor %}
- {%- endif %}
-
- {%- if master.pillar.engine == 'reclass'
- or (master.pillar.engine == 'composite' and
- (master.pillar.saltclass is defined or
- master.pillar.reclass is defined )) %}
-
- master_tops:
- {%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined ) %}
- reclass: *reclass
- {%- endif %}
- {%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}
- saltclass: *saltclass
- {%- endif %}
- {%- endif %}
-
- {%- if master.log is defined %}
-
- {%- if master.log.level is defined %}
- log_level: {{ master.log.level }}
- {%- endif %}
-
- {%- if master.log.file is defined %}
- log_file: {{ master.log.file }}
- {%- endif %}
-
- {%- if master.log.level_logfile is defined %}
- log_level_logfile: {{ master.log.level_logfile }}
- {%- endif %}
-
- {%- endif %}
-
- {%- if pillar.salt.get('minion') %}
- {%- for handler in pillar.salt.minion.get("handlers", []) %}
- {%- if handler.engine == "udp"%}
-
- logstash_udp_handler:
- host: {{ handler.host }}
- port: {{ handler.port }}
- version: 1
- {%- endif %}
- {%- if handler.engine == "zmq"%}
-
- logstash_zmq_handler:
- address: tcp://{{ handler.host }}:{{ handler.port }}
- version: 1
- {%- endif %}
- {%- endfor %}
- {%- endif %}
-
- {%- if master.get('order_masters', False) %}
-
- order_masters: True
- {%- endif %}
-
- {%- if master.nacl is defined %}
-
- nacl.config:
- box_type: {{ master.nacl.get('box_type', 'sealedbox') }}
- {%- if master.nacl.sk is defined %}
- sk: {{ master.nacl.sk }}
- pk: {{ master.nacl.pk }}
- {%- else %}
- sk_file: {{ master.nacl.sk_file }}
- pk_file: {{ master.nacl.pk_file }}
- {%- endif %}
- {%- endif %}
-
- file_recv: {{ master.get('file_recv', False) }}
-
- id: {{ master.id | default(system.name~"."~system.domain) }}
-
- {#-
- vim: syntax=jinja
- -#}
|