2023-07-28 13:18:08 +00:00
|
|
|
---
|
2024-10-28 19:24:14 +00:00
|
|
|
- name: Check if state is valid
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: >-2
|
|
|
|
Unsupported state '{{ elasticsearch_state }}'. Supported
|
|
|
|
states are {{ elasticsearch_states | join(', ') }}.
|
|
|
|
when: elasticsearch_state not in elasticsearch_states
|
2023-07-28 13:18:08 +00:00
|
|
|
|
2024-10-28 19:24:14 +00:00
|
|
|
- name: Ensure host directories are {{ elasticsearch_state }}
|
|
|
|
ansible.builtin.file:
|
2023-07-28 13:18:08 +00:00
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
mode: "0777"
|
|
|
|
loop:
|
|
|
|
- "{{ elasticsearch_base_path }}"
|
|
|
|
- "{{ elasticsearch_data_path }}"
|
|
|
|
|
2024-10-28 19:24:14 +00:00
|
|
|
- name: Ensure elasticsearch container image '{{ elasticsearch_container_image }}' is {{ elasticsearch_state }}
|
|
|
|
community.docker.docker_image:
|
2023-07-28 13:18:08 +00:00
|
|
|
name: "{{ elasticsearch_container_image }}"
|
2024-10-28 19:24:14 +00:00
|
|
|
state: "{{ elasticsearch_state }}"
|
|
|
|
source: "{{ elasticsearch_container_image_source }}"
|
|
|
|
force_source: "{{ elasticsearch_container_image_force_source }}"
|
2023-07-28 13:18:08 +00:00
|
|
|
force_source: "{{ elasticsearch_container_image_tag|default(false, true)|bool }}"
|
|
|
|
|
2024-10-28 19:24:14 +00:00
|
|
|
- name: Ensure elasticsearch container '{{ elasticsearch_container_name }}' is {{ elasticsearch_container_state }}
|
|
|
|
community.docker.docker_container:
|
2023-07-28 13:18:08 +00:00
|
|
|
name: "{{ elasticsearch_container_name }}"
|
|
|
|
image: "{{ elasticsearch_container_image }}"
|
|
|
|
env: "{{ elasticsearch_container_env | default(omit, True) }}"
|
|
|
|
user: "{{ elasticsearch_container_user | default(omit, True) }}"
|
|
|
|
ports: "{{ elasticsearch_container_ports | default(omit, True) }}"
|
|
|
|
labels: "{{ elasticsearch_container_labels | default(omit, True) }}"
|
|
|
|
volumes: "{{ elasticsearch_container_volumes }}"
|
|
|
|
ulimits: "{{ elasticsearch_container_ulimits }}"
|
|
|
|
networks: "{{ elasticsearch_container_networks | default(omit, True) }}"
|
|
|
|
purge_networks: "{{ elasticsearch_container_purge_networks | default(omit, True) }}"
|
|
|
|
restart_policy: "{{ elasticsearch_container_restart_policy }}"
|
2024-10-28 19:24:14 +00:00
|
|
|
state: "{{ elasticsearch_container_state }}"
|