aboutsummaryrefslogtreecommitdiff
path: root/ansible/elasticsearch.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/elasticsearch.yml')
-rw-r--r--ansible/elasticsearch.yml64
1 files changed, 64 insertions, 0 deletions
diff --git a/ansible/elasticsearch.yml b/ansible/elasticsearch.yml
new file mode 100644
index 0000000..670bbe1
--- /dev/null
+++ b/ansible/elasticsearch.yml
@@ -0,0 +1,64 @@
+- hosts:
+ - elasticsearch-servers
+ tasks:
+ - name: Create elasticsearch user
+ become: yes
+ user:
+ name: elasticsearch
+ system: yes
+ state: "{{ elasticsearch__state }}"
+ shell: /bin/bash
+ - become: yes
+ file:
+ path: "{{ elasticsearch__data_dir }}"
+ state: directory
+ owner: elasticsearch
+ group: elasticsearch
+ mode: u=rwx,go=rx
+
+- hosts:
+ - elasticsearch-servers
+ roles:
+ - ansible-elasticsearch
+ vars:
+ es_instance_name: "node1"
+ es_data_dirs:
+ - "{{ elasticsearch__data_dir }}"
+ es_config:
+ http.port: "{{ elasticsearch__http_port }}"
+ transport.tcp.port: "{{ elasticsearch__tcp_port }}"
+ discovery.zen.ping.unicast.hosts: "localhost:9301"
+ es_api_basic_auth_username: admin
+ es_api_basic_auth_password: admin
+ tasks:
+ - name: enable elasticsearch
+ tags: elasticsearch
+ systemd:
+ name: elasticsearch
+ state: started
+ enabled: yes
+
+ - tags: kibana
+ become: yes
+ block:
+ - apt:
+ name: kibana
+ install_recommends: false
+ - lineinfile:
+ path: /etc/kibana/kibana.yml
+ #elasticsearch.url: "http://localhost:9200"
+ regexp: "elasticsearch\\.url"
+ line: 'elasticsearch.url: "http://localhost:{{ elasticsearch__http_port }}"'
+ notify: restart kibana
+ - name: enable kibana
+ systemd:
+ name: kibana
+ state: started
+ enabled: yes
+
+ handlers:
+ - name: restart kibana
+ become: yes
+ systemd:
+ name: kibana
+ state: restarted