From fba2a88ca4a2055c7febb2e117d5a66945a92fe3 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 27 Nov 2021 20:29:59 +0100 Subject: [PATCH] Installation und Einrichtung von ES --- tasks/elastic.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++++ tasks/main.yml | 22 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 tasks/elastic.yml diff --git a/tasks/elastic.yml b/tasks/elastic.yml new file mode 100644 index 0000000..e8ac182 --- /dev/null +++ b/tasks/elastic.yml @@ -0,0 +1,54 @@ +- name: "elastic | Hole Paket" + get_url: + url: "{{ es_url }}" + path: "{{ es_dl_path }}" + +- name: "elastic | Installiere Paket" + command: "dpkg -i elasticsearch-oss-{{ es_version }}-amd64.deb" + args: + chdir: "{{ es_dl_path }}" + +- name: "elastic | Prüfe Plugin" + stat: + path: /usr/share/elasticsearch/plugins/ingest-attachment + register: ingest_plugin + +- name: "elastic | Hole Plugin" + get_url: + url: "{{ es_ingest_attachment_url }}" + path: "{{ es_dl_path }}" + when: ingest_plugin.stat.exists == False + +- name: "eleastic | Installiere Plugin" + command: "elasticsearch-plugin install file:///{{ es_dl_path }}/ingest-attachment-{{ es_ingest_attachment_version }}.zip" + args: + chdir: /usr/share/elasticsearch/bin + when: ingest_plugin.stat.exists == False + +- name: "elastic | Passe Konfiguration an" + lineinfile: + path: /etc/elasticsearch/elasticsearch.yml + line: "{{ item }}" + loop: + - 'http.max_content_length: 400mb' + - 'indices.query.bool.max_clause_count: 2000' + +- name: "elastic | Starte Dienst" + systemd: + name: elasticsearch + state: started + daemon_reload: yes + +- name: "elastic | Konfiguriere ES-Server-Adresse" + shell: + cmd: rbenv exec rails r "Setting.set('es_url', 'http://127.0.0.1:9200')" + chdir: "{{ zammad_home }}" + environment: + RAILS_ENV: production + +- name: "elastic | Erstelle Such-Index" + shell: + cmd: rbenv exec rake searchindex:rebuild + chdir: "{{ zammad_home }}" + environment: + RAILS_ENV: production diff --git a/tasks/main.yml b/tasks/main.yml index 1813c3b..a0f3b70 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,15 +1,37 @@ - import_tasks: packages.yml + tags: packages + - import_tasks: locales.yml + tags: locales + - import_tasks: user.yml + tags: user + - import_tasks: zammad.yml tags: zammad + - import_tasks: ruby.yml tags: ruby + - import_tasks: database.yml tags: database + - import_tasks: syslog.yml + tags: syslog + - import_tasks: webserver.yml + tags: webserver + - import_tasks: systemd.yml + tags: systemd + - import_tasks: monit.yml tags: monit + - import_tasks: gateway.yml + tags: gateway + +- name: Elastic + include_tasks: elastic.yml + when: "'elasticsearch-oss' in ansible_facts.packages == False" + tags: elastic