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.

213 satır
6.5KB

  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 master.log is defined %}
  129. {%- if master.log.level is defined %}
  130. log_level: {{ master.log.level }}
  131. {%- endif %}
  132. {%- if master.log.file is defined %}
  133. log_file: {{ master.log.file }}
  134. {%- endif %}
  135. {%- if master.log.level_logfile is defined %}
  136. log_level_logfile: {{ master.log.level_logfile }}
  137. {%- endif %}
  138. {%- endif %}
  139. {%- if pillar.salt.get('minion') %}
  140. {%- for handler in pillar.salt.minion.get("handlers", []) %}
  141. {%- if handler.engine == "udp"%}
  142. logstash_udp_handler:
  143. host: {{ handler.host }}
  144. port: {{ handler.port }}
  145. version: 1
  146. {%- endif %}
  147. {%- if handler.engine == "zmq"%}
  148. logstash_zmq_handler:
  149. address: tcp://{{ handler.host }}:{{ handler.port }}
  150. version: 1
  151. {%- endif %}
  152. {%- endfor %}
  153. {%- endif %}
  154. {%- if master.get('order_masters', False) %}
  155. order_masters: True
  156. {%- endif %}
  157. {%- if master.nacl is defined %}
  158. nacl.config:
  159. box_type: {{ master.nacl.get('box_type', 'sealedbox') }}
  160. {%- if master.nacl.sk is defined %}
  161. sk: {{ master.nacl.sk }}
  162. pk: {{ master.nacl.pk }}
  163. {%- else %}
  164. sk_file: {{ master.nacl.sk_file }}
  165. pk_file: {{ master.nacl.pk_file }}
  166. {%- endif %}
  167. {%- endif %}
  168. file_recv: {{ master.get('file_recv', False) }}
  169. id: {{ master.id | default(system.name~"."~system.domain) }}
  170. {#-
  171. vim: syntax=jinja
  172. -#}