New version of salt-formula from Saltstack
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

197 lines
6.1KB

  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. pillar_safe_render_error: {{ master.pillar_safe_render_error }}
  34. {%- if master.accept_policy == 'open_mode' %}
  35. open_mode: True
  36. {%- endif %}
  37. {%- if master.accept_policy == 'auto_accept' %}
  38. auto_accept: True
  39. {%- endif %}
  40. {%- if master.get('max_event_size') %}
  41. max_event_size: {{ master.max_event_size }}
  42. {%- endif %}
  43. {%- if master.pillar.engine == 'salt' %}
  44. pillar_roots:
  45. base:
  46. - {{ master.pillar.get('salt', {}).get('path', '/srv/salt/pillar') }}
  47. {%- endif %}
  48. {%- if master.pillar.engine == 'architect' %}
  49. ext_pillar:
  50. - cmd_yaml: 'architect-salt-pillar %s'
  51. master_tops:
  52. ext_nodes: architect-salt-top
  53. {%- endif %}
  54. {%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined) %}
  55. reclass: &reclass
  56. storage_type: {{ master.pillar.get('reclass', {}).get('storage_type', 'yaml_fs') }}
  57. inventory_base_uri: {{ master.pillar.get('reclass', {}).get('inventory_base_uri', '/srv/salt/reclass') }}
  58. {# Additional options, for backward compatibility salt:master:pillar might not be defined #}
  59. {%- if master.pillar.reclass is defined %}
  60. {%- if master.pillar.reclass.reclass_source_path is defined %}
  61. reclass_source_path: {{ master.pillar.reclass.reclass_source_path }}
  62. {%- endif %}
  63. {%- if master.pillar.reclass.get('class_mappings', [])|length > 0 %}
  64. class_mappings:
  65. {%- for mapping in master.pillar.reclass.class_mappings %}
  66. - {{ mapping.target }} {{ mapping.class }}
  67. {%- endfor %}
  68. {%- endif %}
  69. {%- if master.pillar.reclass.get('propagate_pillar_data_to_reclass', False) == True %}
  70. propagate_pillar_data_to_reclass: {{ master.pillar.reclass.propagate_pillar_data_to_reclass }}
  71. {%- endif %}
  72. {%- if master.pillar.reclass.get('ignore_class_notfound', False) == True %}
  73. # Below option is not available in upstream reclass, and require fork https://github.com/salt-formulas/reclass
  74. ignore_class_notfound: {{ master.pillar.reclass.ignore_class_notfound }}
  75. ignore_class_regexp: {{ master.pillar.reclass.ignore_class_regexp }}
  76. {%- endif %}
  77. {%- endif %}
  78. {%- endif %}
  79. {%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}
  80. saltclass: &saltclass
  81. path: {{ master.pillar.saltclass.get('path', '/srv/salt/saltclass') }}
  82. {%- endif %}
  83. {%- if master.pillar.engine in ['composite', 'reclass'] %}
  84. {# generate indexed list of ext_engines #}
  85. {# NONE: Might be rewritten, once proved to work properly, with filters: #}
  86. {# NONE: select('mapping')|selectattr('_index')|sort(attribute='_index') #}
  87. {%- set ext_engines = {} %}
  88. {%- for name,engine in master.pillar.iteritems() %}
  89. {%- if not engine is mapping %}{% continue %}{% endif %}
  90. {%- do engine.update({'name': engine.get('name', name) }) %}
  91. {%- set index = engine.get('index', '1')~'-'~name %}
  92. {%- do ext_engines.update({ index: engine }) %}
  93. {%- endfor %}
  94. {%- if ext_engines|length > 0 or master.pillar.engine == "reclass" %}
  95. ext_pillar:
  96. {%- if master.pillar.engine == 'reclass' %}
  97. {#- too keep backward compatibility, in case master.pillar.reclass is not defied at all #}
  98. - reclass: *reclass
  99. {%- endif %}
  100. {%- for name, engine in ext_engines|dictsort %}
  101. {%- if master.pillar.engine == 'composite' and engine.name == 'reclass' %}
  102. - reclass: *reclass
  103. {%- endif %}
  104. {%- if engine.name == 'saltclass' %}
  105. - saltclass: *saltclass
  106. {%- endif %}
  107. {%- if engine.name == 'nacl' %}
  108. - nacl: {}
  109. {%- endif %}
  110. {%- if engine.name == 'gpg' %}
  111. - gpg: {}
  112. {%- endif %}
  113. {%- endfor %}
  114. {%- endif %}
  115. {%- endif %}
  116. {%- if master.pillar.engine == 'reclass'
  117. or (master.pillar.engine == 'composite' and
  118. (master.pillar.saltclass is defined or
  119. master.pillar.reclass is defined )) %}
  120. master_tops:
  121. {%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined ) %}
  122. reclass: *reclass
  123. {%- endif %}
  124. {%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}
  125. saltclass: *saltclass
  126. {%- endif %}
  127. {%- endif %}
  128. {%- if pillar.salt.get('minion') %}
  129. {%- for handler in pillar.salt.minion.get("handlers", []) %}
  130. {%- if handler.engine == "udp"%}
  131. logstash_udp_handler:
  132. host: {{ handler.host }}
  133. port: {{ handler.port }}
  134. version: 1
  135. {%- endif %}
  136. {%- if handler.engine == "zmq"%}
  137. logstash_zmq_handler:
  138. address: tcp://{{ handler.host }}:{{ handler.port }}
  139. version: 1
  140. {%- endif %}
  141. {%- endfor %}
  142. {%- endif %}
  143. {%- if master.get('order_masters', False) %}
  144. order_masters: True
  145. {%- endif %}
  146. {%- if master.nacl is defined %}
  147. nacl.config:
  148. box_type: {{ master.nacl.get('box_type', 'sealedbox') }}
  149. {%- if master.nacl.sk is defined %}
  150. sk: {{ master.nacl.sk }}
  151. pk: {{ master.nacl.pk }}
  152. {%- else %}
  153. sk_file: {{ master.nacl.sk_file }}
  154. pk_file: {{ master.nacl.pk_file }}
  155. {%- endif %}
  156. {%- endif %}
  157. file_recv: {{ master.get('file_recv', False) }}
  158. id: {{ system.name }}.{{ system.domain }}
  159. {#-
  160. vim: syntax=jinja
  161. -#}