---
# File: dirs.yml - Consul directories

- name: Create directories
  file:
    dest: "{{ item }}"
    state: directory
    owner: "{{ consul_user }}"
    group: "{{ consul_group}}"
    recurse: yes
  with_items:
    - "{{ consul_config_path }}"
    - "{{ consul_configd_path }}"
    - "{{ consul_data_path }}"
    - "{{ consul_log_path }}"
    - "{{ consul_run_path }}"
    - /etc/consul.d
  when: ansible_os_family != 'Windows'

# XXX: This could be a stat instead
- name: Verify binary path
  file:
    path: "{{ consul_bin_path }}"
    state: directory
    owner: root
    mode: 0755
  when: ansible_os_family != 'Windows'

- name: Create directories on Windows
  win_file:
    dest: "{{ item }}"
    state: directory
  with_items:
    - "{{ consul_config_path }}"
    - "{{ consul_configd_path }}"
    - "{{ consul_data_path }}"
    - "{{ consul_log_path }}"
    - "{{ consul_bin_path }}"
  when: ansible_os_family == 'Windows'

---
# File: dirs.yml - Consul directories

- name: Create directories
  file:
    dest: "{{ item }}"
    state: directory
    owner: "{{ consul_user }}"
    group: "{{ consul_group}}"
    recurse: yes
  with_items:
    - "{{ consul_config_path }}"
    - "{{ consul_configd_path }}"
    - "{{ consul_data_path }}"
    - "{{ consul_log_path }}"
    - "{{ consul_run_path }}"
    - "{{ consul_configd_path }}"
  when: ansible_os_family != 'Windows'

# XXX: This could be a stat instead
- name: Verify binary path
  file:
    path: "{{ consul_bin_path }}"
    state: directory
    owner: root
    mode: 0755
  when: ansible_os_family != 'Windows'

- name: Create directories on Windows
  win_file:
    dest: "{{ item }}"
    state: directory
  with_items:
    - "{{ consul_config_path }}"
    - "{{ consul_configd_path }}"
    - "{{ consul_data_path }}"
    - "{{ consul_log_path }}"
    - "{{ consul_bin_path }}"
  when: ansible_os_family == 'Windows'

Replace hardcoded pathes with {{ consul_configd_path }}
Replace hardcoded pathes with {{ consul_configd_path }}
