elasticsearch_nextcloud/tasks/main.yml

75 lines
2 KiB
YAML
Raw Normal View History

2023-01-22 19:54:16 +01:00
---
- name: Set OS dependent variables
ansible.builtin.include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_distribution | lower }}_{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}_{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
- "{{ ansible_system | lower }}.yml"
paths:
- '{{ role_path }}/vars'
ignore_errors: True
- name: OS is supported
ansible.builtin.assert:
that: __os_supported
quiet: True
vars:
__os_supported: "{{ lookup('vars', '{}_os_supported'.format(role_name)) | bool }}"
- name: Add elasticsearch GPG key
shell:
cmd: "wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - "
- name: Install apt-transport-https
apt:
pkg:
- apt-transport-https
state: latest
update_cache: yes
- name: Add elasticsearch repo to sources
2023-01-22 20:11:55 +01:00
copy:
content: "deb https://artifacts.elastic.co/packages/6.x/apt stable main"
dest: "/etc/apt/sources.list.d/elastic-6.x.list"
owner: root
group: root
2023-01-22 19:54:16 +01:00
2023-01-22 20:14:05 +01:00
- name: Install packages
2023-01-22 19:54:16 +01:00
apt:
pkg:
2023-01-22 20:14:05 +01:00
- default-jre
- elasticsearch
2023-01-22 19:54:16 +01:00
state: latest
update_cache: yes
- name: Set config file
template:
src: elasticsearch.yml.j2
dest: /etc/elasticsearch/elasticsearch.yml
owner: root
group: elasticsearch
2023-01-22 20:44:06 +01:00
- name: Ensure elasticsearch is running
service:
name: elasticsearch
state: started
2023-01-22 20:40:41 +01:00
- name: Remove ingest-attachment plugin if installed
shell:
2023-01-22 20:40:41 +01:00
cmd: "{{ nextcloud_elasticsearch_bin_dir }}/elasticsearch-plugin remove ingest-attachment"
ignore_errors: yes
2023-01-22 20:44:06 +01:00
- name: Install ingest-attachment plugin
2023-01-22 20:38:53 +01:00
shell:
2023-01-22 20:40:41 +01:00
cmd: "{{ nextcloud_elasticsearch_bin_dir }}/elasticsearch-plugin install ingest-attachment"
- name: Restart elasticsearch
service:
name: elasticsearch
state: restarted
enabled: yes
2023-01-22 20:20:05 +01:00
daemon_reload: yes