{%- from "salt/map.jinja" import minion with context %} {%- from "linux/map.jinja" import system with context %} {%- if minion.masters is defined %} master: {%- for master in minion.masters %} - {{ master.host }} {%- endfor %} {%- if minion.get('master_type', 'default') == "failover" %} master_type: failover retry_dns: 0 master_shuffle: True master_alive_interval: 60 {%- endif %} {%- else %} master: {{ minion.master.host }} {%- endif %} id: {{ system.name }}.{{ system.domain }} {%- set excluded_keys = ('master', 'system', 'public_keys', 'private_keys', 'known_hosts', '__reclass__', '_secret', '_param') %} grains: {%- if minion.get('manage_roles', True) %} roles: {%- for key, value in pillar.items() %} {%- if key not in excluded_keys %} {%- for subkey, subvalue in value.iteritems() %} {%- if subvalue.enabled is defined and subvalue.enabled %} - {{key}}.{{ subkey }} {%- endif %} {%- endfor %} {%- endif %} {%- endfor %} {%- endif %} services: {%- for key, value in pillar.items() %} {%- if key not in excluded_keys %} - {{key}} {%- endif %} {%- endfor %} grains_dirs: - /var/lib/salt/grains {%- if minion.mine is defined %} mine_functions: {%- for salt_module, salt_functions in minion.mine.module.iteritems() %} {{ salt_module }}: {{ salt_functions }} {%- endfor %} mine_interval: {{ minion.mine.get('interval', 30) }} {%- endif %} log_level: {{ minion.log.get('level', 'error') }} state_output: {{ minion.log.get('state_output', 'changes') }} {%- if minion.proxy is defined %} proxy_host: {{ minion.proxy.host }} proxy_port: {{ minion.proxy.port }} {%- endif %} {%- if minion.sentry is defined %} sentry_handler: {% for server in minion.sentry.servers %} servers: - {{ server }} {% endfor %} project: {{ pillar.salt.minion.sentry.project }} public_key: {{ pillar.salt.minion.sentry.public_key }} secret_key: {{ pillar.salt.minion.sentry.secret_key }} {% if pillar.salt.minion.sentry.log_level is defined %} log_level: {{ pillar.salt.minion.sentry.log_level }} {%- endif %} {%- endif %} {%- if pillar.get('galera', {}).master is defined %} {%- from "galera/map.jinja" import master with context %} mysql.unix_socket: {{ master.socket }} mysql.user: '{{ pillar.galera.master.admin.user }}' mysql.pass: '{{ pillar.galera.master.admin.password }}' mysql.db: 'mysql' mysql.charset: 'utf8' {%- elif pillar.get('galera', {}).slave is defined %} {%- from "galera/map.jinja" import slave with context %} mysql.unix_socket: {{ slave.socket }} mysql.user: '{{ pillar.galera.slave.admin.user }}' mysql.pass: '{{ pillar.galera.slave.admin.password }}' mysql.db: 'mysql' mysql.charset: 'utf8' {%- elif pillar.get('mysql', {}).server is defined %} mysql.unix_socket: /var/run/mysqld/mysqld.sock {%- if pillar.mysql.server.admin is defined %} mysql.user: '{{ pillar.mysql.server.admin.user }}' mysql.pass: '{{ pillar.mysql.server.admin.password }}' {%- else %} mysql.user: 'root' mysql.pass: '' {%- endif %} mysql.db: 'mysql' mysql.charset: 'utf8' {%- endif %} {%- if pillar.get('mongodb', {}).server is defined %} mongodb.host: 'localhost' mongodb.port: {{ pillar.mongodb.server.bind.port }} mongodb.user: '{{ pillar.mongodb.server.admin.user }}' mongodb.password: '{{ pillar.mongodb.server.admin.password }}' {%- endif %} {%- if pillar.get('postgresql', {}).server is defined %} postgres.user: 'postgres' postgres.pass: '' postgres.db: 'template1' {%- endif %} {%- if pillar.get('gitlab', {}).client is defined %} gitlab.url: 'https://{{ pillar.gitlab.client.server.host }}/' gitlab.token: '{{ pillar.gitlab.client.server.token }}' {%- elif pillar.get('gitlab', {}).server is defined %} gitlab.url: 'https://{{ pillar.gitlab.server.server_name }}/' gitlab.token: '{{ pillar.gitlab.server.get('token', 'Set token in pillar') }}' {%- endif %} {%- if pillar.get('keystone', {}).get('server', {'enabled': False } ).enabled %} keystone.token: '{{ pillar.keystone.server.service_token }}' keystone.endpoint: 'http://{{ pillar.keystone.server.bind.private_address }}:{{ pillar.keystone.server.bind.private_port }}/v2.0' {%- endif %} {%- for handler in pillar.salt.minion.get("handlers", []) %} {%- if handler.engine == "udp"%} logstash_udp_handler: host: {{ handler.host }} port: {{ handler.port }} version: 1 {%- endif %} {%- if handler.engine == "zmq"%} logstash_zmq_handler: address: tcp://{{ handler.host }}:{{ handler.port }} version: 1 {%- endif %} {%- endfor %}