Skip to content

Commit

Permalink
check if es directories exist and then create the one which are not p…
Browse files Browse the repository at this point in the history
…resent
  • Loading branch information
AmitPhulera committed Oct 24, 2024
1 parent f9a79f7 commit 98c2f9d
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 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,20 +142,27 @@
- 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"

- 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 }}"

- name: Start Elasticsearch
become: yes
service: name=elasticsearch state=started enabled=yes
Expand Down

0 comments on commit 98c2f9d

Please sign in to comment.