New version of salt-formula from Saltstack
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

187 líneas
5.9KB

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