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.7KB

8 anni fa
8 anni fa
8 anni fa
8 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. retry_dns: 0
  11. master_shuffle: True
  12. master_alive_interval: 60
  13. {%- endif %}
  14. {%- else %}
  15. master: {{ minion.master.host }}
  16. {%- endif %}
  17. id: {{ minion.id | default(system.name~"."~system.domain) }}
  18. {%- set opt_list=[
  19. 'acceptance_wait_time',
  20. 'acceptance_wait_time_max',
  21. 'auth_timeout',
  22. 'cachedir',
  23. 'grains_refresh_every',
  24. 'master_alive_interval',
  25. 'master_tries',
  26. 'max_event_size',
  27. 'random_reauth_delay',
  28. 'recon_default',
  29. 'recon_max'
  30. ] %}
  31. {%- for opt in opt_list %}
  32. {%- if minion.get(opt) %}
  33. {{ opt }}: {{ minion.get(opt) }}
  34. {%- endif %}
  35. {%- endfor %}
  36. {%- if minion.grains_cache is defined %}
  37. grains_cache: {{ minion.grains_cache }}
  38. {%- endif %}
  39. {%- if minion.recon_randomize is defined %}
  40. recon_randomize: {{ minion.recon_randomize }}
  41. {%- endif %}
  42. {%- if minion.rejected_retry is defined %}
  43. rejected_retry: {{ minion.rejected_retry }}
  44. {%- endif %}
  45. {%- set excluded_keys = ('master', 'system', 'public_keys', 'private_keys', 'known_hosts', '__reclass__', '_secret', '_param') %}
  46. grains:
  47. {%- if minion.get('manage_roles', True) %}
  48. roles:
  49. {%- for key, value in pillar.items() %}
  50. {%- if key not in excluded_keys %}
  51. {%- for subkey, subvalue in value.iteritems() %}
  52. {%- if subvalue.enabled is defined and subvalue.enabled %}
  53. - {{key}}.{{ subkey }}
  54. {%- endif %}
  55. {%- endfor %}
  56. {%- endif %}
  57. {%- endfor %}
  58. {%- endif %}
  59. services:
  60. {%- for key, value in pillar.items() %}
  61. {%- if key not in excluded_keys %}
  62. - {{key}}
  63. {%- endif %}
  64. {%- endfor %}
  65. grains_dirs:
  66. - /var/lib/salt/grains
  67. {%- if minion.mine is defined %}
  68. mine_functions:
  69. {%- for salt_module, salt_functions in minion.mine.module.iteritems() %}
  70. {{ salt_module }}: {{ salt_functions }}
  71. {%- endfor %}
  72. mine_interval: {{ minion.mine.get('interval', 30) }}
  73. {%- endif %}
  74. {%- if minion.log is defined %}
  75. {%- if minion.log.level is defined %}
  76. log_level: {{ minion.log.level }}
  77. {%- endif %}
  78. {%- if minion.log.file is defined %}
  79. log_file: {{ minion.log.file }}
  80. {%- endif %}
  81. {%- if minion.log.level_logfile is defined %}
  82. log_level_logfile: {{ minion.log.level_logfile }}
  83. {%- endif %}
  84. {%- endif %}
  85. state_output: {{ minion.get('log', {}).get('state_output', 'changes') }}
  86. {%- if minion.get('proxy', {}).get('host', "") != "" %}
  87. proxy_host: {{ minion.proxy.host }}
  88. proxy_port: {{ minion.proxy.port }}
  89. {%- endif %}
  90. {%- if minion.backend is defined %}
  91. backend: {{ minion.backend }}
  92. {%- endif %}
  93. {%- if minion.sentry is defined %}
  94. sentry_handler:
  95. {% for server in minion.sentry.servers %}
  96. servers:
  97. - {{ server }}
  98. {% endfor %}
  99. project: {{ pillar.salt.minion.sentry.project }}
  100. public_key: {{ pillar.salt.minion.sentry.public_key }}
  101. secret_key: {{ pillar.salt.minion.sentry.secret_key }}
  102. {% if pillar.salt.minion.sentry.log_level is defined %}
  103. log_level: {{ pillar.salt.minion.sentry.log_level }}
  104. {%- endif %}
  105. {%- endif %}
  106. {%- if pillar.get('galera', {}).get('master', {}).get('enabled', False) %}
  107. {%- from "galera/map.jinja" import master with context %}
  108. mysql.unix_socket: {{ master.socket }}
  109. mysql.user: '{{ pillar.galera.master.admin.user }}'
  110. mysql.pass: '{{ pillar.galera.master.admin.password }}'
  111. mysql.db: 'mysql'
  112. mysql.charset: 'utf8'
  113. {%- elif pillar.get('galera', {}).get('slave', {}).get('enabled', False) %}
  114. {%- from "galera/map.jinja" import slave with context %}
  115. mysql.unix_socket: {{ slave.socket }}
  116. mysql.user: '{{ pillar.galera.slave.admin.user }}'
  117. mysql.pass: '{{ pillar.galera.slave.admin.password }}'
  118. mysql.db: 'mysql'
  119. mysql.charset: 'utf8'
  120. {%- elif pillar.get('mysql', {}).get('server', {}).get('enabled', False) %}
  121. mysql.unix_socket: /var/run/mysqld/mysqld.sock
  122. {%- if pillar.mysql.server.admin is defined %}
  123. mysql.user: '{{ pillar.mysql.server.admin.user }}'
  124. mysql.pass: '{{ pillar.mysql.server.admin.password }}'
  125. {%- else %}
  126. mysql.user: 'root'
  127. mysql.pass: ''
  128. {%- endif %}
  129. mysql.db: 'mysql'
  130. mysql.charset: 'utf8'
  131. {%- endif %}
  132. {%- if pillar.get('mongodb', {}).server is defined %}
  133. mongodb.host: 'localhost'
  134. mongodb.port: {{ pillar.mongodb.server.bind.port }}
  135. {%- if pillar.mongodb.server.get('admin', {}).user is defined %}
  136. mongodb.user: '{{ pillar.mongodb.server.admin.user }}'
  137. {%- endif %}
  138. {%- if pillar.mongodb.server.get('admin', {}).password is defined %}
  139. mongodb.password: '{{ pillar.mongodb.server.admin.password }}'
  140. {%- endif %}
  141. {%- endif %}
  142. {%- if pillar.get('postgresql', {}).server is defined %}
  143. postgres.user: 'postgres'
  144. postgres.pass: ''
  145. postgres.db: 'template1'
  146. {%- endif %}
  147. {%- if pillar.get('gitlab', {}).client is defined %}
  148. gitlab.url: 'https://{{ pillar.gitlab.client.server.host }}/'
  149. gitlab.token: '{{ pillar.gitlab.client.server.token }}'
  150. {%- elif pillar.get('gitlab', {}).server is defined %}
  151. gitlab.url: 'https://{{ pillar.gitlab.server.server_name }}/'
  152. gitlab.token: '{{ pillar.gitlab.server.get('token', 'Set token in pillar') }}'
  153. {%- endif %}
  154. {%- if pillar.get('keystone', {}).get('server', {'enabled': False } ).enabled %}
  155. keystone.token: '{{ pillar.keystone.server.service_token }}'
  156. keystone.endpoint: 'http://{{ pillar.keystone.server.bind.private_address }}:{{ pillar.keystone.server.bind.private_port }}/v2.0'
  157. {%- endif %}
  158. {%- for handler in pillar.salt.minion.get("handlers", []) %}
  159. {%- if handler.engine == "udp"%}
  160. logstash_udp_handler:
  161. host: {{ handler.host }}
  162. port: {{ handler.port }}
  163. version: 1
  164. {%- endif %}
  165. {%- if handler.engine == "zmq"%}
  166. logstash_zmq_handler:
  167. address: tcp://{{ handler.host }}:{{ handler.port }}
  168. version: 1
  169. {%- endif %}
  170. {%- endfor %}
  171. {#-
  172. vim: syntax=jinja
  173. -#}