---
- name: cluster/configure | Ensure the vault directories exist
  file:
    dest: "{{ item }}"
    owner: vault
    mode: 0750
    state: directory
    recurse: true
  with_items:
    - "{{ vault_base_dir }}"
    - "{{ vault_cert_dir }}"
    - "{{ vault_config_dir }}"
    - "{{ vault_roles_dir }}"
    - "{{ vault_secrets_dir }}"
    - "{{ vault_log_dir }}"
    - "{{ vault_lib_dir }}"

- name: cluster/configure | Lay down the configuration file
  copy:
    content: "{{ vault_config | to_nice_json(indent=4) }}"
    dest: "{{ vault_config_dir }}/config.json"
    mode: 0640
  register: vault_config_change
