|
- {%- 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.master_type == "failover" %}
- master_type: failover
- master_shuffle: True
- master_alive_interval: 60
- {%- endif %}
-
- {%- else %}
-
- master: {{ minion.master.host }}
-
- {%- endif %}
-
- id: {{ system.name }}.{{ system.domain }}
-
- grains:
- {%- if minion.get('manage_roles', True) %}
- roles:
- {%- for key, value in pillar.items() %}
- {%- if key != 'master' and key != 'system' and key != 'public_keys' and key != 'private_keys' and key != 'known_hosts' and key != '__reclass__' and key != '_secret' %}
- {%- for subkey, subvalue in value.iteritems() %}
- {%- if subvalue.enabled is defined %}
- {%- if subvalue.enabled %}
- - {{key}}.{{ subkey }}
- {%- endif %}
- {%- endif %}
- {%- endfor %}
- {%- endif %}
- {%- endfor %}
- {%- endif %}
- services:
- {%- for key in pillar.__reclass__.applications %}
- - {{key}}
- {%- 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 %}
-
-
- {%- 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'
- {%- elif pillar.get('keystone', {}).get('client', {'enabled': False } ).enabled %}
- {%- if pillar.keystone.client.server.service_token is defined %}
- keystone.token: '{{ pillar.keystone.client.server.service_token }}'
- keystone.endpoint: 'http://{{ pillar.keystone.client.server.host }}:{{ pillar.keystone.client.server.private_port }}/v2.0'
- {%- else %}
- keystone.user: '{{ pillar.keystone.client.server.user }}'
- keystone.password: '{{ pillar.keystone.client.server.password }}'
- keystone.tenant: '{{ pillar.keystone.client.server.tenant }}'
- keystone.auth_url: 'http://{{ pillar.keystone.client.server.host }}:{{ pillar.keystone.client.server.public_port }}/v2.0/'
- {%- endif %}
- {%- 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 %}
|