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.

151 lines
4.3KB

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