New version of salt-formula from Saltstack
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

156 lines
4.7KB

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