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.

174 líneas
4.8KB

  1. {%- from "salt/map.jinja" import minion with context %}
  2. {%- from "linux/map.jinja" import system with context %}
  3. {%- if minion.masters is defined %}
  4. master:
  5. {%- for master in minion.masters %}
  6. - {{ master.host }}
  7. {%- endfor %}
  8. {%- if minion.get('master_type', 'default') == "failover" %}
  9. master_type: failover
  10. retry_dns: 0
  11. master_shuffle: True
  12. master_alive_interval: 60
  13. {%- endif %}
  14. {%- else %}
  15. master: {{ minion.master.host }}
  16. {%- endif %}
  17. id: {{ system.name }}.{{ system.domain }}
  18. {%- for opt in ['max_event_size', 'acceptance_wait_time_max',
  19. 'acceptance_wait_time', 'random_reauth_delay', 'recon_default', 'recon_max',
  20. 'recon_randomize', 'auth_timeout'] %}
  21. {% if minion.get(opt) %}
  22. {{ opt }}: {{ minion.get(opt) }}
  23. {%- endif %}
  24. {%- endfor %}
  25. {%- set excluded_keys = ('master', 'system', 'public_keys', 'private_keys', 'known_hosts', '__reclass__', '_secret', '_param') %}
  26. grains:
  27. {%- if minion.get('manage_roles', True) %}
  28. roles:
  29. {%- for key, value in pillar.items() %}
  30. {%- if key not in excluded_keys %}
  31. {%- for subkey, subvalue in value.iteritems() %}
  32. {%- if subvalue.enabled is defined and subvalue.enabled %}
  33. - {{key}}.{{ subkey }}
  34. {%- endif %}
  35. {%- endfor %}
  36. {%- endif %}
  37. {%- endfor %}
  38. {%- endif %}
  39. services:
  40. {%- for key, value in pillar.items() %}
  41. {%- if key not in excluded_keys %}
  42. - {{key}}
  43. {%- endif %}
  44. {%- endfor %}
  45. grains_dirs:
  46. - /var/lib/salt/grains
  47. {%- if minion.mine is defined %}
  48. mine_functions:
  49. {%- for salt_module, salt_functions in minion.mine.module.iteritems() %}
  50. {{ salt_module }}: {{ salt_functions }}
  51. {%- endfor %}
  52. mine_interval: {{ minion.mine.get('interval', 30) }}
  53. {%- endif %}
  54. log_level: {{ minion.log.get('level', 'error') }}
  55. state_output: {{ minion.log.get('state_output', 'changes') }}
  56. {%- if minion.proxy is defined %}
  57. proxy_host: {{ minion.proxy.host }}
  58. proxy_port: {{ minion.proxy.port }}
  59. {%- endif %}
  60. {%- if minion.backend is defined %}
  61. backend: {{ minion.backend }}
  62. {%- endif %}
  63. {%- if minion.sentry is defined %}
  64. sentry_handler:
  65. {% for server in minion.sentry.servers %}
  66. servers:
  67. - {{ server }}
  68. {% endfor %}
  69. project: {{ pillar.salt.minion.sentry.project }}
  70. public_key: {{ pillar.salt.minion.sentry.public_key }}
  71. secret_key: {{ pillar.salt.minion.sentry.secret_key }}
  72. {% if pillar.salt.minion.sentry.log_level is defined %}
  73. log_level: {{ pillar.salt.minion.sentry.log_level }}
  74. {%- endif %}
  75. {%- endif %}
  76. {%- if pillar.get('galera', {}).get('master', {}).get('enabled', False) %}
  77. {%- from "galera/map.jinja" import master with context %}
  78. mysql.unix_socket: {{ master.socket }}
  79. mysql.user: '{{ pillar.galera.master.admin.user }}'
  80. mysql.pass: '{{ pillar.galera.master.admin.password }}'
  81. mysql.db: 'mysql'
  82. mysql.charset: 'utf8'
  83. {%- elif pillar.get('galera', {}).get('slave', {}).get('enabled', False) %}
  84. {%- from "galera/map.jinja" import slave with context %}
  85. mysql.unix_socket: {{ slave.socket }}
  86. mysql.user: '{{ pillar.galera.slave.admin.user }}'
  87. mysql.pass: '{{ pillar.galera.slave.admin.password }}'
  88. mysql.db: 'mysql'
  89. mysql.charset: 'utf8'
  90. {%- elif pillar.get('mysql', {}).get('server', {}).get('enabled', False) %}
  91. mysql.unix_socket: /var/run/mysqld/mysqld.sock
  92. {%- if pillar.mysql.server.admin is defined %}
  93. mysql.user: '{{ pillar.mysql.server.admin.user }}'
  94. mysql.pass: '{{ pillar.mysql.server.admin.password }}'
  95. {%- else %}
  96. mysql.user: 'root'
  97. mysql.pass: ''
  98. {%- endif %}
  99. mysql.db: 'mysql'
  100. mysql.charset: 'utf8'
  101. {%- endif %}
  102. {%- if pillar.get('mongodb', {}).server is defined %}
  103. mongodb.host: 'localhost'
  104. mongodb.port: {{ pillar.mongodb.server.bind.port }}
  105. mongodb.user: '{{ pillar.mongodb.server.admin.user }}'
  106. mongodb.password: '{{ pillar.mongodb.server.admin.password }}'
  107. {%- endif %}
  108. {%- if pillar.get('postgresql', {}).server is defined %}
  109. postgres.user: 'postgres'
  110. postgres.pass: ''
  111. postgres.db: 'template1'
  112. {%- endif %}
  113. {%- if pillar.get('gitlab', {}).client is defined %}
  114. gitlab.url: 'https://{{ pillar.gitlab.client.server.host }}/'
  115. gitlab.token: '{{ pillar.gitlab.client.server.token }}'
  116. {%- elif pillar.get('gitlab', {}).server is defined %}
  117. gitlab.url: 'https://{{ pillar.gitlab.server.server_name }}/'
  118. gitlab.token: '{{ pillar.gitlab.server.get('token', 'Set token in pillar') }}'
  119. {%- endif %}
  120. {%- if pillar.get('keystone', {}).get('server', {'enabled': False } ).enabled %}
  121. keystone.token: '{{ pillar.keystone.server.service_token }}'
  122. keystone.endpoint: 'http://{{ pillar.keystone.server.bind.private_address }}:{{ pillar.keystone.server.bind.private_port }}/v2.0'
  123. {%- endif %}
  124. {%- for handler in pillar.salt.minion.get("handlers", []) %}
  125. {%- if handler.engine == "udp"%}
  126. logstash_udp_handler:
  127. host: {{ handler.host }}
  128. port: {{ handler.port }}
  129. version: 1
  130. {%- endif %}
  131. {%- if handler.engine == "zmq"%}
  132. logstash_zmq_handler:
  133. address: tcp://{{ handler.host }}:{{ handler.port }}
  134. version: 1
  135. {%- endif %}
  136. {%- endfor %}
  137. {#-
  138. vim: syntax=jinja
  139. -#}