---

- name: Create needed directories
  file: path={{ consul_root_dir }}/{{ item.dir }} state=directory owner={{ item.owner | default(omit) }} group={{ item.group | default(omit) }} mode={{ item.mode | default(omit) }}
  loop:
    - dir: archives
      owner: root
      group: root
      mode: 700
    - dir: backup
      owner: root
      group: root
      mode: 700
    - dir: meta
      owner: root
      group: root
      mode: 700
    - dir: bin
    - dir: tmp
      owner: "{{ consul_user }}"
      group: "{{ consul_user }}"
      mode: 700
    - dir: data
      owner: "{{ consul_user }}"
      group: "{{ consul_user }}"
      mode: 700
    - dir: etc
      owner: root
      group: "{{ consul_user }}"
      mode: 750
  tags: consul
