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.

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