You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@fluo.apache.org by GitBox <gi...@apache.org> on 2020/04/01 23:09:28 UTC

[GitHub] [fluo-muchos] arvindshmicrosoft commented on a change in pull request #338: WIP# 254

arvindshmicrosoft commented on a change in pull request #338: WIP# 254 
URL: https://github.com/apache/fluo-muchos/pull/338#discussion_r401957545
 
 

 ##########
 File path: ansible/roles/elasticsearch/tasks/main.yml
 ##########
 @@ -0,0 +1,78 @@
+---
+#
+# Installing Elasticsearch
+#
+
+ # Add the Elasticsearch yum repo. 
+
+- name: "download elasticsearch rpm"
+  get_url: 
+  args:
+    url: https://artifacts.elastic.co/downloads/elasticsearch/{{ elasticsearch_rpm }}
+    dest: /tmp/{{ elasticsearch_rpm }}
+    force: no  
+  
+#Check for file exists 
+
+- name: "check that file exists in directory"
+  stat: 
+    path: /tmp/{{ elasticsearch_rpm }}
+    register: stat_result
+
+ #Install elasticsearch    
+
+- name: "ensure elasticsearch is installed"
+  become: true
+  yum: name=/tmp/{{ elasticsearch_rpm }} state=present
+  when: stat_result.stat.exists == False
+
+
+# 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'
+  become: true
+ 
+# 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'
+  become: true
+
+#Update Discovery Settings in config file
+
+- name: Update the Discovery Seed Host 
+  lineinfile:
+   destfile: /etc/elasticsearch/elasticsearch.yml
+   regexp: 'discovery.seed_hosts:'
+   line: 'discovery.seed_hosts: ["leader1"]'
+  become: true
+
+  #Update Discovery Settings in config file
+
+- name: Update the Discovery Seed Host 
+  lineinfile:
+   destfile: /etc/elasticsearch/elasticsearch.yml
+   regexp: 'cluster.initial_master_nodes:'
+   line: 'cluster.initial_master_nodes: ["leader1"]'
+  become: true
+
+#Enable Elasticsearch 
+- name: Enable Elasticsearch
+  service: 
+   name: elasticsearch 
+   enabled: yes
+  become: true
+
+# Restart Elasticsearch
+- name: Start Elasticsearch
+  service: 
+   name: elasticsearch
+   state: started
+  become: yes
 
 Review comment:
   Please ensure there is a newline at the end of the file. An easy way to check for this is to run the below from repo root:
   ```
   find . -type f -a -not -regex '.*/[.]git/.*' -exec grep -Iq . {} \; -print0 | xargs -0 -L 1 bash -c 'test "$(tail -
   c 1 "$0")" && echo "No new line at end of $0"'
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services