Elasticsearch Playbook
The Ansible playbook below can be used to quickly install an Elasticsearch server.
An Elasticsearch server is an important part of your ELK stack. You can store all kinds of items in it.
In the case of an ELK stack it will be used to store metrics.
This is rather easy to install. You can follow the instructions at the website of Elastic or use the playbook below.
--- - hosts: ESServers tasks: - name: Install some packages, in this case Java and apt-transport-https apt: name: "{{ packages }}" update_cache: yes vars: packages: - default-jre - apt-transport-https - name: Add an Apt signing key, will not download if present apt_key: url: https://artifacts.elastic.co/GPG-KEY-elasticsearch state: present - name: Add Elasticsearch repository into sources list apt_repository: repo: deb https://artifacts.elastic.co/packages/6.x/apt stable main state: present - name: Update repositories cache and install Elasticsearch package apt: name: elasticsearch update_cache: yes
Once installed you need to modify the configuration file a bit.
Instructions can be found here.
Of course, after you modified the config file, reload the Elasticsearch configuration.