charlesa101 / es-ansible-installation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ElasticSearch Instalation with Ansible

This Ansible playbook sets up a multi-node Elasticsearch. The playbook assumes Ubuntu 20.04 LTS as the operating system.

As long as you don't specify the version this playbook will install latest version of 8.x.x of Elasticserach.

You can try to install a specif version, by changing to older repository url on the playbook.

Requirements

  • Ansible 2.9.6 or higher
  • Access to three Ubuntu 20.04 LTS servers
  • SSH access to each server with sudo privileges

Usage

  1. Clone this repository to your local machine:

     git clone https://github.com/devopsrange/es-ansible-installation
    
  2. Modify the inventory.ini file to include the hostnames or IP addresses of your three servers.

  3. Modify the elasticsearch.yml.j2 file to set the cluster name, JVM heap size, network host, and xpack security settings as desired.

  4. Run the Ansible-Playbook, be sure your user have permission to make changes on the remote hosts, or you can add -u root, parameter to auth as a root user to other hosts

     ansible-playbook -i inventory.ini playbook.yml -u root
    
  5. You need to mannually run these commands, and copy the password when the promp on the screen, after generating the password go to Kibana configuration file, which is in /etc/kibana, then re-write the password for kibana_system user.

    Create elasticsearch password (passwords must be same with certificate passwords.), on es01, es02, es03.

     /usr/share/elasticsearch/bin/elasticsearch-keystore create -p
    

    Generate passwords for built-in users on es01,

     /usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto
    

Configuration

The variables can be set in the elasticsearch.yml.j2 file to customize the Elasticsearch installation.

To uninstall the elastic search some helpfull commands.

sudo apt-get --purge autoremove elasticsearch -y
sudo apt-get remove --purge elasticsearch 
sudo rm -rf /etc/elasticsearch
sudo rm -rf /var/lib/elasticsearch

About


Languages

Language:Jinja 100.0%