|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- {%- 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' and key != '_param' %}
- {%- 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, 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' and key != '_param' %}
- - {{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 %}
-
- {%- 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 %}
|