ansible-roles/elasticsearch/tasks/plugin_head.yml
Jérémy Lecour ee21973371
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2777|524|2253|2462|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/223//ansiblelint">Evolix » ansible-roles » unstable #223</a>
gitea/ansible-roles/pipeline/head This commit looks good
Use FQCN
Fully Qualified Collection Name
2023-03-20 23:33:19 +01: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: yes
- 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