---
- name: Fetch the oh-my-zsh installer
  ansible.builtin.get_url:
    url: https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
    dest: /tmp/oh-my-zsh.sh
    mode: 0700

- name: Install oh-my-zsh
  ansible.builtin.command:
    cmd: sh /tmp/oh-my-zsh.sh --unattended
    creates: ~/.oh-my-zsh

- name: Clone zsh-autosuggestions
  ansible.builtin.git:
    repo: https://github.com/zsh-users/zsh-autosuggestions
    dest: ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
    update: no

- name: Clone zsh-syntax-highlighting
  ansible.builtin.git:
    repo: https://github.com/zsh-users/zsh-syntax-highlighting.git
    dest: ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
    update: no

- name: Clone zsh-aliases-exa
  ansible.builtin.git:
    repo: https://github.com/DarrinTisdale/zsh-aliases-exa.git
    dest: ~/.oh-my-zsh/custom/plugins/zsh-aliases-exa
    update: no

- name: Create the config
  ansible.builtin.template:
    src: templates/zshrc
    dest: ~/.zshrc
    mode: 0600