Commit 2dc809a7 authored by Daniel Berman's avatar Daniel Berman Committed by GitHub
Browse files

Update main.yml

parent e57f6cca
......@@ -2,31 +2,45 @@
#
# Installing Elasticsearch
#
# Install Elasticsearch
- name: Install Elasticsearch
- shell: sudo wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
- shell: sudo apt-get install apt-transport-https
- shell: sudo echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
- shell: sudo apt-get update && sudo apt-get install elasticsearch
# Configurations
- name: Updating the config file to allow remote access
# Add Elasticsearch apt key
- name: Add Elasticsearch apt-key
apt_key:
url: "https://packages.elastic.co/GPG-KEY-elasticsearch"
state: present
# Add the Elasticsearch apt repo
- name: Adding Elasticsearch repo
apt_repository:
repo: deb https://artifacts.elastic.co/packages/5.x/apt stable main
state: present
# Installing Elasticsearch
- name: Update repositories cache and install Elasticsearch
apt:
name: elasticsearch
update_cache: yes
# Update Elasticsearch config file to allow access. To secure Elasticsearch, bind to 'localhost'.
- name: Updating the config file to allow outside access
lineinfile:
destfile: /etc/elasticsearch/elasticsearch.yml
regexp: 'network.host:'
line: 'network.host: 0.0.0.0'
- name: Updating the config file to define port
destfile: /etc/elasticsearch/elasticsearch.yml
regexp: 'network.host:'
line: 'network.host: 0.0.0.0'
# Update Elasticsearch port in config file
- name: Updating the port in config file
lineinfile:
destfile: /etc/elasticsearch/elasticsearch.yml
regexp: 'http.port:'
line: 'http.port: 9200'
# Starting Elasticsearch
- name: Enabling Elasticsearch service
systemd:
name: elasticsearch
enabled: yes
daemon_reload: yes
# Start Elasticsearch service
- name: Starting Elasticsearch service
systemd:
name: elasticsearch
state: started
destfile: /etc/elasticsearch/elasticsearch.yml
regexp: 'http.port:'
line: 'http.port: 9200'
# Start Elasticsearch
- name: Starting Elasticsearch
service:
name: elasticsearch
state: started
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment