databases/roles/elasticsearch/defaults/main.yml

51 lines
2.1 KiB
YAML

---
elasticsearch_version: 7.17.7
elasticsearch_state: present
elasticsearch_base_path: /opt/elasticsearch
elasticsearch_data_path: "{{ elasticsearch_base_path }}/data"
elasticsearch_config_cluster_name: elastic
elasticsearch_config_discovery_type: single-node
elasticsearch_config_boostrap_memory_lock: true
elasticsearch_allocated_ram_mb: 512
elasticsearch_container_image_registry: docker.elastic.co
elasticsearch_container_image_namespace: elasticsearch
elasticsearch_container_image_name: elasticsearch-oss
elasticsearch_container_image_tag: ~
elasticsearch_container_image: >-2
{{
([
elasticsearch_container_image_registry | default([], true),
elasticsearch_container_image_namespace | default([], true),
elasticsearch_container_image_name,
] | flatten | join('/'))
+ ':' +
(elasticsearch_container_image_tag | default(elasticsearch_version, true))
}}
elasticsearch_container_image_source: pull
elasticsearch_container_image_force_source: >-2
{{ elasticsearch_container_image_tag | default(false, true) | bool }}
elasticsearch_container_name: elasticsearch
elasticsearch_container_env:
"ES_JAVA_OPTS": "-Xms{{ elasticsearch_allocated_ram_mb }}m -Xmx{{ elasticsearch_allocated_ram_mb }}m"
"cluster.name": "{{ elasticsearch_config_cluster_name }}"
"discovery.type": "{{ elasticsearch_config_discovery_type }}"
"bootstrap.memory_lock": "{{ 'true' if elasticsearch_config_boostrap_memory_lock else 'false' }}"
elasticsearch_container_user: ~
elasticsearch_container_ports: ~
elasticsearch_container_labels:
version: "{{ elasticsearch_version }}"
elasticsearch_container_ulimits:
# - "memlock:{{ (1.5 * 1024 * elasticsearch_allocated_ram_mb) | int }}:{{ (1.5 * 1024 * elasticsearch_allocated_ram_mb) | int }}"
- "memlock:-1:-1"
elasticsearch_container_volumes:
- "{{ elasticsearch_data_path }}:/usr/share/elasticsearch/data:z"
elasticsearch_container_networks: ~
elasticsearch_container_purge_networks: ~
elasticsearch_container_restart_policy: unless-stopped
elasticsearch_container_state: >-2
{{ (elasticsearch_state == 'present') | ternary('started', 'absent') }}