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.

166 rindas
4.5KB

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