This role:
- installs metricbeat on Ubuntu, Debian, CentOS, Windows
- copies prepared configuration file (log path, connect to elasticsearch, etc.)
- Prepare server (add elastic repo)
- [Optional] Create folder(s) for custom paths
- Install metricbeat
- Copy configuration file
- Minimal Version of the ansible for installation: 2.7
- Supported OS:
- EL (RedHat, CentOS)
- 7, 8
- Ubuntu
- 16.04
- 18.04
- Debian
- 8, 9
- Windows Server
- 2016, 2019
- EL (RedHat, CentOS)
You can override any variable below by setting "variable: value" in playbook.
metricbeat_version
Is used to select main Metricbeat branch to be installed (5.x or 6.x current stable versions). Default value is6
.metricbeat_last_version
Is used to select specific Metricbeat version to be installed. Default value is6.6.0
elastic_gpg_key
GPG-key from elasticsearch repository. Default value ishttps://artifacts.elastic.co/GPG-KEY-elasticsearch
metricbeat_node_name
Name of the metricbeat node. Default value is{{ inventory_hostname }}
. If this options is not defined, the hostname is used.metricbeat_ssl_enabled
Turns on/off SSL connection between metricbeat and logstash/elasticsearch. SSL options should be set by corresponding dict fields like shown below:
ssl:
key: "/etc/pki/tls/private/server.key"
certificate: "/etc/pki/tls/certs/server.crt"
certificate_authorities: "/etc/pki/CA/ca-root.pem"
in case of Windows setup:
ssl:
key: 'c:\tls\private\server.key'
certificate: 'c:\tls\certs\server.pem'
certificate_authorities: 'c:\CA\ca-root.pem'
The path
section of the configuration options defines where Metricbeat looks for its files. For example, Metricbeat looks for the Elasticsearch template file in the configuration path and writes log files in the logs path. Metricbeat looks for its registry files in the data path. Default values for Linux host are set up this way:
path:
home: /usr/share/metricbeat
config: /etc/metricbeat
data: /var/lib/metricbeat
logs: /var/log/metricbeat
in case of Windows setup default paths look like:
path:
home: 'c:\program files\metricbeat'
config: 'c:\program files\metricbeat'
data: 'c:\programdata\metricbeat'
logs: 'c:\programdata\metricbeat\logs'
-
win_download_path
Temp directory for Windows to download and upzip Metricbeat package. Default value is'{{ ansible_env.TEMP }}/metricbeat'
(ansible_env.TEMP value solves idempotence issue) -
input_logpath
Path to log files.
Default value for *NIX OS family is "/var/log/*.log"
Default value for WIN OS family is 'c:\windows\*.log'
-
metricbeat_output
Is used to configure what output to use when sending data (elasticsearch
orlogstash
). Default value iselasticsearch
-
elasticsearch.host
Array of hosts to connect to. Default value islocalhost
-
elasticsearch.port
Value for setting custom port. Default value is9200
-
logstash.host
Array of hosts to connect to. Default value islocalhost
-
logstash.port
Value for setting custom port. Default value is5044
The metricbeat(systemd)\initd
section of the configuration options defines which init script will be used to manage metricbeat service depending on the *nix OS. Custom paths will be taken into account (if configured).
-
metricbeat_service_name
Name of nssm\init script, which manages metricbeat service -
metricbeat_bulk_max_size
Maximum number of events to bulk in a single Logstash request. Default value is500
-
metricbeat_worker
Number of workers per Elasticsearch host. Default value is1
-
metricbeat_logging_to_syslog
Send all logging output to syslog. Default value isfalse
-
metricbeat_logging_to_files
Send all logging output to rotating files. Default value istrue
-
metricbeat_rotateeverybytes
Defines log file size limit. Defalt value is104857600
=100MB
-
metricbeat_keepfiles
Number of log files to keep. Default value is30
-
metricbeat_ignore_older
Value (any time strings like 2h, 5m can be used) above which files will be ignored. Default value is0
(disabled) -
metricbeat_scan_frequency
Defines how often metricbeat checks file updates. Default value is15s
-
metricbeat_harvester_buffer_size
Defines the buffer size. Default value is65535
-
metricbeat_logname
Name of the logging files. Default value is"metricbeat.log"
ca-cert (only for installation with SSL)
- name: Install metricbeat
hosts: all
roles:
- role: ansible-role-metricbeat
- name: Install metricbeat
hosts: all
roles:
- role: ansible-role-metricbeat
vars:
elasticsearch:
host: elasticsearch.example.com
port: 9200
authors:
- Lean Delivery Team [email protected]