---

- name: create vault directories
  file:
    path: "{{ item }}"
    state: directory
  with_items:
    - "{{ vault_config_path }}"
    - "{{ vault_data_path }}"
    - "{{ vault_config_template_path }}"

- name: Create systemd service UNIT
  template:
    src: vault/systemd.service
    dest: /etc/systemd/system/vault.service
    owner: root
    group: root
    mode: 0644

# Config template files
- name: create vault template config files
  template:
    src: "vault/config/{{ item }}"
    dest: "{{ vault_config_template_path }}/{{ item }}"
    variable_start_string: "€#"
    variable_end_string: "#€"
    block_start_string: "€%"
    block_end_string: "%€"
  with_items:
    - vault.hcl
    - consul.hcl
