---
- name: "zsh : Set user shell"
  ansible.builtin.user:
    name: "{{ ansible_user_id }}"
    shell: /bin/zsh
    state: present

- name: "zsh : Symlink startup files"
  ansible.builtin.include_tasks: symlink_dotfile.yml
  vars:
    dotfile_src: "{{ item.src | default(item) }}"
    dotfile_dest: "{{ item.dest | default(item) }}"
  loop:
    - zshenv
    - zshrc
    - zprofile

- name: "zsh : Install user functions"
  block:
    - name: "zsh : Create zsh directory"
      ansible.builtin.file:
        path: ~/.zsh
        owner: "{{ ansible_user_id }}"
        mode: 0755
        state: directory

    - name: "zsh : Symlink functions directories"
      ansible.builtin.include_tasks: symlink_dotfile_directory.yml
      vars:
        dotfile_src: "{{ item }}"
      loop:
        - zsh/func
