metricbeat: new variables to configure elasticsearch hosts and auth
This commit is contained in:
parent
cb9e48b41d
commit
cfd5e3d7f2
|
@ -11,6 +11,7 @@ The **patch** part changes incrementally at each release.
|
|||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
* metricbeat: new variables to configure elasticsearch hosts and auth
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -1,2 +1,7 @@
|
|||
---
|
||||
elastic_stack_version: "6.x"
|
||||
|
||||
metricbeat_elasticsearch_hosts:
|
||||
- "localhost:9200"
|
||||
metricbeat_elasticsearch_auth_username: ""
|
||||
metricbeat_elasticsearch_auth_password: ""
|
||||
|
|
|
@ -39,3 +39,27 @@
|
|||
systemd:
|
||||
name: metricbeat
|
||||
enabled: yes
|
||||
|
||||
- name: Metricbeat knows where to find Elasticsearch
|
||||
lineinfile:
|
||||
dest: /etc/metricbeat/metricbeat.yml
|
||||
regexp: '^ hosts: .*'
|
||||
line: " hosts: [\"{{ metricbeat_elasticsearch_hosts | join('\", \"') }}\"]"
|
||||
insertafter: "output.elasticsearch:"
|
||||
notify: restart metricbeat
|
||||
when:
|
||||
- metricbeat_elasticsearch_hosts
|
||||
|
||||
- name: Metricbeat auth/username for Elasticsearch are configured
|
||||
lineinfile:
|
||||
dest: /etc/metricbeat/metricbeat.yml
|
||||
regexp: '{{ item.regexp }}'
|
||||
line: '{{ item.line }}'
|
||||
insertafter: "output.elasticsearch:"
|
||||
with_items:
|
||||
- { regexp: '^ #username: .*', line: ' username: "{{ metricbeat_elasticsearch_auth_username }}"' }
|
||||
- { regexp: '^ #password: .*', line: ' password: "{{ metricbeat_elasticsearch_auth_password }}"' }
|
||||
notify: restart metricbeat
|
||||
when:
|
||||
- metricbeat_elasticsearch_auth_username != ""
|
||||
- metricbeat_elasticsearch_auth_password != ""
|
||||
|
|
Loading…
Reference in New Issue