mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Update elasticsearch ansible role
- bump version from 8.8.0 to 8.16.1 - don't enable the systemd service by default(just start it) - add restart handler on config changes - configure before starting the service - fix some linter errors - hardcode auto_create_indexes to true
This commit is contained in:
committed by
Dan Christian Bogos
parent
2b5a3e5a5e
commit
7c204f68e0
@@ -3,16 +3,7 @@
|
||||
roles:
|
||||
- ../roles/rabbitmq
|
||||
- ../roles/nats
|
||||
- role: ../roles/elasticsearch
|
||||
vars:
|
||||
auto_create_index: ".monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*,cdrs"
|
||||
|
||||
# # Trying for now to overwrite the auto_create_index defaults.
|
||||
# # In case of failure, we will be using the commented task below:
|
||||
# - name: Create 'cdrs' index in Elasticsearch for CGRateS integration tests
|
||||
# command: 'curl -X PUT "localhost:9200/cdrs?pretty"'
|
||||
# ignore_errors: yes
|
||||
|
||||
- ../roles/elasticsearch
|
||||
- ../roles/kafka
|
||||
- ../roles/mongodb
|
||||
- ../roles/postgresql
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
---
|
||||
elasticsearch_version: "8.8.0"
|
||||
elasticsearch_version: "8.16.1"
|
||||
elasticsearch_deb_url: "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{{ elasticsearch_version }}-amd64.deb"
|
||||
elasticsearch_deb_sha_url: "{{ elasticsearch_deb_url }}.sha512"
|
||||
elasticsearch_gpg_key_url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch"
|
||||
elasticsearch_gpg_keyring: "/usr/share/keyrings/elasticsearch-keyring.gpg"
|
||||
elasticsearch_repository: "deb [signed-by={{ elasticsearch_gpg_keyring }}] https://artifacts.elastic.co/packages/8.x/apt stable main"
|
||||
auto_create_index: ".monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*"
|
||||
elasticsearch_service_enabled: true
|
||||
elasticsearch_service_enabled: false
|
||||
elasticsearch_service_state: started
|
||||
elasticsearch_service_masked: false
|
||||
elasticsearch_dependencies:
|
||||
- apt-transport-https
|
||||
|
||||
8
data/ansible/roles/elasticsearch/handlers/main.yaml
Normal file
8
data/ansible/roles/elasticsearch/handlers/main.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Restart elasticsearch
|
||||
become: true
|
||||
ansible.builtin.systemd_service:
|
||||
name: elasticsearch
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
when: elasticsearch_service_state == 'started'
|
||||
@@ -1,42 +1,41 @@
|
||||
---
|
||||
- name: Install Elasticsearch dependencies
|
||||
become: true
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: "{{ elasticsearch_dependencies }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
cache_valid_time: 86400
|
||||
|
||||
- name: Import Elasticsearch PGP Key
|
||||
become: true
|
||||
apt_key:
|
||||
ansible.builtin.apt_key:
|
||||
url: "{{ elasticsearch_gpg_key_url }}"
|
||||
keyring: "{{ elasticsearch_gpg_keyring }}"
|
||||
state: present
|
||||
|
||||
- name: Add Elasticsearch APT repository
|
||||
become: true
|
||||
apt_repository:
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "{{ elasticsearch_repository }}"
|
||||
state: present
|
||||
|
||||
- name: Update APT cache and install Elasticsearch
|
||||
become: true
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: elasticsearch
|
||||
update_cache: yes
|
||||
state: present
|
||||
|
||||
- name: Enable and start Elasticsearch service
|
||||
become: true
|
||||
systemd:
|
||||
name: elasticsearch.service
|
||||
enabled: "{{ elasticsearch_service_enabled }}"
|
||||
state: "{{ elasticsearch_service_state }}"
|
||||
masked: "{{ elasticsearch_service_masked }}"
|
||||
update_cache: true
|
||||
|
||||
- name: Configure Elasticsearch
|
||||
become: true
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: elasticsearch.yml.j2
|
||||
dest: /etc/elasticsearch/elasticsearch.yml
|
||||
mode: "0644"
|
||||
notify: Restart elasticsearch
|
||||
|
||||
- name: Ensure elasticsearch service is in desired state
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: elasticsearch.service
|
||||
enabled: "{{ elasticsearch_service_enabled }}"
|
||||
state: "{{ elasticsearch_service_state }}"
|
||||
|
||||
@@ -5,7 +5,7 @@ path.data: "/var/lib/elasticsearch"
|
||||
path.logs: "/var/log/elasticsearch"
|
||||
network.host: "127.0.0.1"
|
||||
http.port: 9200
|
||||
action.auto_create_index: "{{ auto_create_index }}"
|
||||
action.auto_create_index: "true"
|
||||
xpack.security.enabled: false
|
||||
xpack.security.transport.ssl.enabled: false
|
||||
xpack.security.http.ssl.enabled: false
|
||||
xpack.security.http.ssl.enabled: false
|
||||
|
||||
Reference in New Issue
Block a user