New version of salt-formula from Saltstack
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

183 rindas
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', {}).get('storage_type', 'yaml_fs') }}
  50. inventory_base_uri: {{ master.pillar.get('reclass', {}).get('inventory_base_uri', '/srv/salt/reclass') }}
  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. {%- if pillar.salt.get('minion') %}
  122. {%- for handler in pillar.salt.minion.get("handlers", []) %}
  123. {%- if handler.engine == "udp"%}
  124. logstash_udp_handler:
  125. host: {{ handler.host }}
  126. port: {{ handler.port }}
  127. version: 1
  128. {%- endif %}
  129. {%- if handler.engine == "zmq"%}
  130. logstash_zmq_handler:
  131. address: tcp://{{ handler.host }}:{{ handler.port }}
  132. version: 1
  133. {%- endif %}
  134. {%- endfor %}
  135. {%- endif %}
  136. {%- if master.get('order_masters', False) %}
  137. order_masters: True
  138. {%- endif %}
  139. {%- if master.nacl is defined %}
  140. nacl.config:
  141. box_type: {{ master.nacl.get('box_type', 'sealedbox') }}
  142. {%- if master.nacl.sk is defined %}
  143. sk: {{ master.nacl.sk }}
  144. pk: {{ master.nacl.pk }}
  145. {%- else %}
  146. sk_file: {{ master.nacl.sk_file }}
  147. pk_file: {{ master.nacl.pk_file }}
  148. {%- endif %}
  149. {%- endif %}
  150. {#-
  151. vim: syntax=jinja
  152. -#}