ansible-role-opensearch/tasks/main.yml
2023-05-13 08:30:14 +02:00

66 lines
No EOL
1.9 KiB
YAML

---
- name: "Opensearch | Füge Schlüssel des Apt-Repositories hinzu"
ansible.builtin.apt_key:
url: "{{ opensearch_apt_key_url }}"
- name: "Opensearch | Füge Repository hinzu"
ansible.builtin.apt_repository:
repo: "deb {{ opensearch_apt_repo }}"
update_cache: true
- name: "Opensearch | Installiere deb-Paket"
ansible.builtin.apt:
name: opensearch
- name: "Opensearch | Installiere Ingest-Plugin"
ansible.builtin.command:
cmd: ./opensearch-plugin install ingest-attachment --batch
chdir: /usr/share/opensearch/bin/
creates: /usr/share/opensearch/plugins/ingest-attachment
become: true
become_user: opensearch
- name: "Opensearch | Kopiere Opensearch-Konfiguration"
ansible.builtin.template:
src: opensearch.yml.j2
dest: /etc/opensearch/opensearch.yml
mode: "0644"
- name: "Opensearch | Setze empfohlene Optionen"
ansible.builtin.replace:
path: /etc/opensearch/jvm.options
regexp: "{{ item.regexp }}"
replace: "{{ item.replace }}"
loop:
- regexp: '^-Xms[0-9]*g$'
replace: -Xms{{ (ansible_memtotal_mb / 1024 * 0.5) | round | int }}g
- regexp: '^-Xmx[0-9]*g$'
replace: -Xmx{{ (ansible_memtotal_mb / 1024 * 0.5) | round | int }}g
notify: restart opensearch
- name: "Opensearch | Starte Opensearch-Dienst"
ansible.builtin.systemd:
name: opensearch
enabled: true
state: started
daemon_reload: true
- name: "Opensearch | Richte Monit-Überwachung ein"
ansible.builtin.template:
src: opensearch.monit.j2
dest: /etc/monit/conf-enabled/opensearch
mode: "0644"
notify: reload monit
- name: "Opensearch | Kopiere Update-Skript"
ansible.builtin.template:
src: update-opensearch-plugins.j2
dest: "/usr/local/bin/{{ opensearch_plugin_update_script }}"
mode: "0755"
- name: "Opensearch | Kopiere DPKG-Hook"
ansible.builtin.template:
src: 72opensearch-updates.j2
dest: /etc/apt/apt.conf.d/72opensearch-updates
mode: "0644"