ansible-roles/elasticsearch/tasks/plugin_head.yml
Jérémy Lecour a6bac1f20b
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2593|3|2590|23|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/280//ansiblelint">Evolix » ansible-roles » unstable #280</a>
gitea/ansible-roles/pipeline/head This commit looks good
change syntax "become: [yes,no]" → "become: [true,false]"
2023-07-03 14:21:22 +02:00

76 lines
1.9 KiB
YAML

---
- name: "User {{ elasticsearch_plugin_head_owner }} is present"
ansible.builtin.user:
name: "{{ elasticsearch_plugin_head_owner }}"
home: "{{ elasticsearch_plugin_head_home }}"
createhome: yes
system: yes
shell: /bin/false
- name: Head plugin is installed
block:
- name: Head repository is checked-out
ansible.builtin.git:
repo: "https://github.com/mobz/elasticsearch-head.git"
dest: "{{ elasticsearch_plugin_head_clone_dir }}"
clone: yes
tags:
- packages
- name: Create tmpdir
ansible.builtin.file:
dest: "{{ elasticsearch_plugin_head_tmp_dir }}"
state: directory
- name: NPM packages for head are installed
community.general.npm:
path: "{{ elasticsearch_plugin_head_clone_dir }}"
tags:
- packages
- npm
environment:
TMPDIR: "{{ elasticsearch_plugin_head_tmp_dir }}"
become_user: "{{ elasticsearch_plugin_head_owner }}"
become: true
- name: Elasticsearch HTTP/CORS are enabled
ansible.builtin.lineinfile:
dest: /etc/elasticsearch/elasticsearch.yml
line: "http.cors.enabled: true"
regexp: "^http.cors.enabled:"
insertafter: EOF
notify:
- restart elasticsearch
tags:
- elasticsearch
- name: Elasticsearch HTTP/CORS accepts all origins
ansible.builtin.lineinfile:
dest: /etc/elasticsearch/elasticsearch.yml
line: "http.cors.allow-origin: \"*\""
regexp: "^http.cors.allow-origin:"
insertafter: "http.cors.enabled"
notify:
- restart elasticsearch
tags:
- elasticsearch
- name: Install systemd unit
ansible.builtin.template:
src: elasticsearch-head.service.j2
dest: /etc/systemd/system/elasticsearch-head.service
tags:
- elasticsearch
- systemd
- name: Enable systemd unit
ansible.builtin.systemd:
name: elasticsearch-head
daemon_reload: yes
enabled: yes
state: started
tags:
- elasticsearch
- systemd