New version of salt-formula from Saltstack
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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