- name: Vim
  hosts: localhost
  connection: local
  tags:
    - vim
  tasks:
    - name: 'Configure Vim for each user'
      ansible.builtin.include_role:
        name: jfhbrook.vim
      vars:
        shell_user: '{{ item.key }}'
        vim_owner: '{{ item.key }}'
        vim_manage_packages: false
        vim_installed_plugins:
          - name: dracula
            repo: 'https://github.com/dracula/vim.git'
            type: start
          - name: vim-which-key
            repo: 'https://github.com/liuchengxu/vim-which-key.git'
            type: start
          - name: fzf
            repo: 'https://github.com/junegunn/fzf'
            type: start
          - name: fzf.vim
            repo: 'https://github.com/junegunn/fzf.vim'
            type: start
      loop: '{{ users | dict2items }}'
    - name: 'Write .vimrc for {{ item.key }}'
      ansible.builtin.copy:
        src: 'vimrc'
        dest: '/home/{{ item.key }}/.vimrc'
        owner: '{{ item.key }}'
        group: '{{ item.key }}'
        mode: '0644'
      loop: '{{ users | dict2items }}'
