New version of salt-formula from Saltstack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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