Skip to content

Commit

Permalink
create data directories if they do not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitPhulera committed Oct 24, 2024
1 parent f9a79f7 commit 148c315
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/commcare_cloud/ansible/roles/elasticsearch/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,30 @@
- debug: msg="If you're just updating the ES conf then you sill need to restart the cluster. Use the 'es_rolling_restart' playbook."
when: copy_elasticsearch_conf_result.changed

- name: Create Elasticsearch data directories
become: yes
file:
- name: Check if Elasticsearch data directories exist
stat:
path: "{{ item }}"
state: directory
owner: elasticsearch
group: elasticsearch
mode: 0755
register: dir_stat
with_items:
- "{{ elasticsearch_data_dir }}"
- "{{ elasticsearch_data_dir }}/data"
- "{{ elasticsearch_data_dir }}/logs"
- "{{ elasticsearch_data_dir }}/tmp"
tags:
- es_conf

- name: Create Elasticsearch data directories if they do not exist
become: yes
file:
path: "{{ item.item }}"
state: directory
owner: elasticsearch
group: elasticsearch
mode: 0755
when: not item.stat.exists
with_items: "{{ dir_stat.results }}"
tags:
- es_conf

- name: Start Elasticsearch
become: yes
Expand Down

0 comments on commit 148c315

Please sign in to comment.