mirror of
https://github.com/valitydev/salt-common.git
synced 2024-11-06 10:25:23 +00:00
Fix ordering in filebeat configuration state
This commit is contained in:
parent
a05b124d8a
commit
ee3d0d5d93
@ -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)])
|
||||
|
Loading…
Reference in New Issue
Block a user