New version of salt-formula from Saltstack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
5.8KB

  1. {%- from "salt/map.jinja" import master with context %}
  2. {%- from "linux/map.jinja" import system with context %}
  3. worker_threads: {{ master.worker_threads }}
  4. timeout: {{ master.command_timeout }}
  5. {%- if master.get('max_open_files') %}
  6. max_open_files: {{ master.max_open_files }}
  7. {%- endif %}
  8. state_output: {{ master.get('state_output', 'changes') }}
  9. {%- if master.system is defined %}
  10. file_roots:
  11. base:
  12. - {{ master.dir.files }}/{{ master.system.environment }}
  13. {%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
  14. - {{ master.dir.files }}/{{ master.system.environment }}/{{ formula_name }}
  15. {%- endfor %}
  16. {{ master.system.environment }}:
  17. - {{ master.dir.files }}/{{ master.system.environment }}
  18. {%- for formula_name, formula in master.system.get('formula', {}).iteritems() %}
  19. - {{ master.dir.files }}/{{ master.system.environment }}/{{ formula_name }}
  20. {%- endfor %}
  21. {%- else %}
  22. file_roots:
  23. {%- for environment_name, environment in master.get('environment', {}).iteritems() %}
  24. {%- if master.base_environment == environment_name %}
  25. base:
  26. - {{ master.dir.files }}/{{ environment_name }}
  27. {%- endif %}
  28. {{ environment_name }}:
  29. - {{ master.dir.files }}/{{ environment_name }}
  30. {%- endfor %}
  31. {%- endif %}
  32. pillar_opts: False
  33. {%- if master.accept_policy == 'open_mode' %}
  34. open_mode: True
  35. {%- endif %}
  36. {%- if master.accept_policy == 'auto_accept' %}
  37. auto_accept: True
  38. {%- endif %}
  39. {%- if master.get('max_event_size') %}
  40. max_event_size: {{ master.max_event_size }}
  41. {%- endif %}
  42. {%- if master.pillar.engine == 'salt' %}
  43. pillar_roots:
  44. base:
  45. - {{ master.pillar.get('salt', {}).get('path', '/srv/salt/pillar') }}
  46. {%- endif %}
  47. {%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined) %}
  48. reclass: &reclass
  49. storage_type: {{ master.pillar.get('reclass', {'storage_type': 'yaml_fs'}).storage_type }}
  50. inventory_base_uri: {{ master.pillar.get('reclass', {'inventory_base_uri': '/srv/salt/reclass'}).inventory_base_uri }}
  51. {# Additional options, for backward compatibility salt:master:pillar might not be defined #}
  52. {%- if master.pillar.reclass is defined %}
  53. {%- if master.pillar.reclass.reclass_source_path is defined %}
  54. reclass_source_path: {{ master.pillar.reclass.reclass_source_path }}
  55. {%- endif %}
  56. {%- if master.pillar.reclass.get('class_mappings', [])|length > 0 %}
  57. class_mappings:
  58. {%- for mapping in master.pillar.reclass.class_mappings %}
  59. - {{ mapping.target }} {{ mapping.class }}
  60. {%- endfor %}
  61. {%- endif %}
  62. {%- if master.pillar.reclass.get('propagate_pillar_data_to_reclass', False) == True %}
  63. propagate_pillar_data_to_reclass: {{ master.pillar.reclass.propagate_pillar_data_to_reclass }}
  64. {%- endif %}
  65. {%- if master.pillar.reclass.get('ignore_class_notfound', False) == True %}
  66. # Below option is not available in upstream reclass, and require fork https://github.com/salt-formulas/reclass
  67. ignore_class_notfound: {{ master.pillar.reclass.ignore_class_notfound }}
  68. ignore_class_regexp: {{ master.pillar.reclass.ignore_class_regexp }}
  69. {%- endif %}
  70. {%- endif %}
  71. {%- endif %}
  72. {%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}
  73. saltclass: &saltclass
  74. path: {{ master.pillar.saltclass.get('path', '/srv/salt/saltclass') }}
  75. {%- endif %}
  76. {%- if master.pillar.engine in ['composite', 'reclass'] %}
  77. {# generate indexed list of ext_engines #}
  78. {# NONE: Might be rewritten, once proved to work properly, with filters: #}
  79. {# NONE: select('mapping')|selectattr('_index')|sort(attribute='_index') #}
  80. {%- set ext_engines = {} %}
  81. {%- for name,engine in master.pillar.iteritems() %}
  82. {%- if not engine is mapping %}{% continue %}{% endif %}
  83. {%- do engine.update({'name': engine.get('name', name) }) %}
  84. {%- set index = engine.get('index', '1')~'-'~name %}
  85. {%- do ext_engines.update({ index: engine }) %}
  86. {%- endfor %}
  87. {%- if ext_engines|length > 0 or master.pillar.engine == "reclass" %}
  88. ext_pillar:
  89. {%- if master.pillar.engine == 'reclass' %}
  90. {#- too keep backward compatibility, in case master.pillar.reclass is not defied at all #}
  91. - reclass: *reclass
  92. {%- endif %}
  93. {%- for name, engine in ext_engines|dictsort %}
  94. {%- if master.pillar.engine == 'composite' and engine.name == 'reclass' %}
  95. - reclass: *reclass
  96. {%- endif %}
  97. {%- if engine.name == 'saltclass' %}
  98. - saltclass: *saltclass
  99. {%- endif %}
  100. {%- if engine.name == 'nacl' %}
  101. - nacl: {}
  102. {%- endif %}
  103. {%- if engine.name == 'gpg' %}
  104. - gpg: {}
  105. {%- endif %}
  106. {%- endfor %}
  107. {%- endif %}
  108. {%- endif %}
  109. {%- if master.pillar.engine == 'reclass'
  110. or (master.pillar.engine == 'composite' and
  111. (master.pillar.saltclass is defined or
  112. master.pillar.reclass is defined )) %}
  113. master_tops:
  114. {%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined ) %}
  115. reclass: *reclass
  116. {%- endif %}
  117. {%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}
  118. saltclass: *saltclass
  119. {%- endif %}
  120. {%- endif %}
  121. {%- for handler in pillar.salt.minion.get("handlers", []) %}
  122. {%- if handler.engine == "udp"%}
  123. logstash_udp_handler:
  124. host: {{ handler.host }}
  125. port: {{ handler.port }}
  126. version: 1
  127. {%- endif %}
  128. {%- if handler.engine == "zmq"%}
  129. logstash_zmq_handler:
  130. address: tcp://{{ handler.host }}:{{ handler.port }}
  131. version: 1
  132. {%- endif %}
  133. {%- endfor %}
  134. {%- if master.get('order_masters', False) %}
  135. order_masters: True
  136. {%- endif %}
  137. {%- if master.nacl is defined %}
  138. nacl.config:
  139. box_type: {{ master.nacl.get('box_type', 'sealedbox') }}
  140. {%- if master.nacl.sk is defined %}
  141. sk: {{ master.nacl.sk }}
  142. pk: {{ master.nacl.pk }}
  143. {%- else %}
  144. sk_file: {{ master.nacl.sk_file }}
  145. pk_file: {{ master.nacl.pk_file }}
  146. {%- endif %}
  147. {%- endif %}
  148. {#-
  149. vim: syntax=jinja
  150. -#}