---
- name: make worker1 directory
  ansible.builtin.file:
    path: "{{ item }}"
    state: directory
    mode: u+rwx,g+rwx,o+rwx
    recurse: yes
    owner: root
    group: root
  with_items:
    - /media/data/minio/pv1
    - /media/data/minio/pv2
    - /media/data/postgres/postgres-data-0
    - /media/data/elasticsearch/elasticsearch-data-0
    - /media/data/zookeeper/zookeeper-data-0
    - /media/data/kafka/kafka-data-0
    - /media/cloudmoa/ingester/ingester-data-1
    - /media/data/redis/redis-data-0
    - /media/data/redis/redis-data-1
    - /media/data/rabbitmq
  when: inventory_hostname in groups["worker1"]
  delegate_to: "{{ inventory_hostname }}"
  
- name: make worker2 directory
  ansible.builtin.file:
    path: "{{ item }}"
    state: directory
    mode: u+rwx,g+rwx,o+rwx
    recurse: yes
    owner: root
    group: root
  with_items:
    - /media/data/minio/pv3
    - /media/data/minio/pv4
    - /media/data/elasticsearch/elasticsearch-data-1
    - /media/data/zookeeper/zookeeper-data-1
    - /media/data/zookeeper/zookeeper-data-2
    - /media/data/kafka/kafka-data-1
    - /media/data/kafka/kafka-data-2
    - /media/cloudmoa/ingester/ingester-data-2
    - /media/cloudmoa/ingester/ingester-data-3
    - /media/data/redis/redis-data-1
    - /media/data/redis/redis-data-2
  when: inventory_hostname in groups["worker2"]
  delegate_to: "{{ inventory_hostname }}"
