Fix ordering in filebeat configuration state

This commit is contained in:
Antsiferov Grigory 2019-04-26 18:12:02 +03:00
parent a05b124d8a
commit ee3d0d5d93

View File

@ -39,13 +39,6 @@ config['filebeat']['inputs'] = pillar('filebeat:inputs')
config['output'] = pillar('filebeat:output')
dictupdate.update(config, pillar('filebeat:config', {}))
File.managed(
conf_path + 'filebeat.yml',
mode=640, user='root', group='root',
# check_cmd='filebeat test config -c',
contents="# This file is generated by Salt\n" + yaml.dump(config),
require=[File(conf_path)])
if elastic_template:
File.managed(
conf_path + 'filebeat.template.json',
@ -56,18 +49,24 @@ else:
File.absent(conf_path + 'filebeat.template.json')
for out in config['output'].keys():
if out in tls:
out_enabled = out.get('enabled', True)
if out in tls.keys():
out_ssl = {}
config['output'][out]['ssl'] = out_ssl
out_ssl['enabled'] = out_enabled
out_ssl['enabled'] = tls[out].get('enabled', True)
for pemtype in ('cert', 'key', 'ca'):
contents = tls[out].get(pemtype, tls.get(pemtype, ''))
path = conf_path + out + '-' + pemtype + '.pem'
if contents:
if pemtype == 'cert': out_ssl['certificate'] = path
if pemtype == 'key': out_ssl['key'] = path
if pemtype == 'ca': out_ssl['certificate_authorities'] = [path]
elif pemtype == 'cert': out_ssl['certificate'] = path
elif pemtype == 'key': out_ssl['key'] = path
File.managed(
path, mode=600, user='root', group='root',
contents=contents, require=[File(conf_path)])
File.managed(
conf_path + 'filebeat.yml',
mode=640, user='root', group='root',
# check_cmd='filebeat test config -c',
contents="# This file is generated by Salt\n" + yaml.dump(config),
require=[File(conf_path)])