mirror of
https://github.com/valitydev/salt-common.git
synced 2024-11-06 10:25:23 +00:00
Add elasticsearch.curator configuration states;
This commit is contained in:
parent
8d3af9bb86
commit
b846d3bff9
40
sls/elasticsearch/curator.sls
Normal file
40
sls/elasticsearch/curator.sls
Normal file
@ -0,0 +1,40 @@
|
||||
#!pydsl
|
||||
# -*- mode: python -*-
|
||||
from salt.utils import dictupdate
|
||||
import yaml
|
||||
|
||||
hosts = __salt__['pillar.get']('elastic:hosts', [])
|
||||
|
||||
# defaults
|
||||
config = {
|
||||
'client': {
|
||||
'hosts': hosts,
|
||||
'master_only': False
|
||||
},
|
||||
'logging': {
|
||||
'loglevel': 'INFO',
|
||||
'logformat': 'default'
|
||||
}
|
||||
}
|
||||
|
||||
dictupdate.update(config, __salt__['pillar.get']('elastic:curator:config', {}))
|
||||
|
||||
include('python.dev-python.elasticsearch-curator')
|
||||
|
||||
state('/etc/elasticsearch/curator.yml').file.managed(
|
||||
mode=644, user='root', group='root', makedirs=True,
|
||||
contents="# This file is generated by Salt\n" + yaml.dump(config))
|
||||
|
||||
state('/etc/elasticsearch/curator-actions.yml').file.managed(
|
||||
mode=644, user='root', group='root', makedirs=True,
|
||||
contents="# This file is generated by Salt\n" + yaml.dump({
|
||||
'actions': __salt__['pillar.get']('elastic:curator:actions', {})
|
||||
}))
|
||||
|
||||
cron = __salt__['pillar.get']('elastic:curator:cron')
|
||||
if cron:
|
||||
state('curator-cron').cron.present(
|
||||
identifier='curator-cron', hour=cron.get('hour', '1'), minute=cron.get('minute', '0'),
|
||||
user=cron.get('user', 'elasticsearch'),
|
||||
name='curator --config /etc/elasticsenarch/curator.yml /etc/elasticsearch/curator-actions.yml').\
|
||||
require(pkg='dev-python/elasticsearch-curator')
|
Loading…
Reference in New Issue
Block a user