mirror of
https://github.com/valitydev/salt-common.git
synced 2024-11-07 10:48:59 +00:00
3d17f33117
sls/kibana: moved to common sls/python/dev-python/docker-py.sls: version bump.
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
#!pydsl
|
|
# -*- mode: python -*-
|
|
from salt.utils import dictupdate
|
|
import yaml
|
|
|
|
state('/etc/elasticsearch/').file.directory(
|
|
create=True, mode=755, user='root', group='root')
|
|
|
|
fqdn = __salt__['grains.get']('fqdn')
|
|
fqdn_ipv6 = __salt__['grains.get']('fqdn_ipv6')
|
|
hosts = __salt__['pillar.get']('elastic:hosts', [])
|
|
|
|
# defaults
|
|
config = {
|
|
'node': {
|
|
'name': '${HOSTNAME}',
|
|
'master': False, 'data': False,
|
|
'max_local_storage_nodes': 1,
|
|
},
|
|
'path': {
|
|
'data': '/var/lib/elasticsearch',
|
|
'logs': '/var/log/elasticsearch',
|
|
},
|
|
'bootstrap': { 'mlockall': True },
|
|
'network': { 'host': '${HOSTNAME}' },
|
|
'http': { 'port': 9200 },
|
|
'gateway': { 'recover_after_nodes': len(hosts)/2 },
|
|
'discovery': { 'zen': {
|
|
'minimum_master_nodes': 1,
|
|
'ping': { 'unicast': {}},
|
|
}},
|
|
}
|
|
|
|
config['discovery']['zen']['ping']['unicast']['hosts'] = filter(
|
|
lambda x: x != fqdn and x not in fqdn_ipv6,
|
|
hosts)
|
|
dictupdate.update(config, __pillar__['elastic']['config'])
|
|
|
|
state('/etc/elasticsearch/elasticsearch.yml').file.managed(
|
|
mode=644, user='root', group='root',
|
|
contents="# This file is generated by Salt\n" + yaml.dump(config))
|