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.

minion.conf 5.0KB

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