- hosts: all
  vars:
    dotfiles_repo: "https://github.com/rynffoll/dotfiles"
    dotfiles_name: "dotfiles"
    dotfiles_branch: "master"
    dotfiles_dest: "~/Projects"
    dotfiles_home: "~"
    dotfiles_files:
      - ".bashrc"
      - ".tmux.conf"
      - ".config/mpv/config"
      - ".config/gtk-3.0/gtk.css"
      - "bin"
  tasks:
    - name: Clone dotfiles
      git:
        repo: "{{ dotfiles_repo }}"
        version: "{{ dotfiles_branch }}"
        dest: "{{ dotfiles_dest }}/{{ dotfiles_name }}"
        clone: no
      tags:
        - dotfiles

    - name: Backup default dotfiles
      copy:
        src: "{{ dotfiles_home }}/{{ item }}"
        dest: "{{ dotfiles_home }}/{{ item }}.backup"
        force: no
      with_items: "{{ dotfiles_files }}"
      ignore_errors: yes
      tags:
        - dotfiles
        - backup

    - name: Prepare dotfiles destination
      file:
        path: "{{ (dotfiles_home ~ '/' ~ item) | dirname }}"
        state: directory
      with_items: "{{ dotfiles_files }}"
      tags:
        - dotfiles

    - name: Install dotfiles
      file:
        src: "{{ dotfiles_dest }}/{{ dotfiles_name }}/{{ item }}"
        dest: "{{ dotfiles_home }}/{{ item }}"
        state: link
        force: yes
      with_items: "{{ dotfiles_files }}"
      tags:
        - dotfiles

- hosts: all
  vars:
    dotfiles_repo: "https://github.com/rynffoll/dotfiles"
    dotfiles_name: "dotfiles"
    dotfiles_branch: "master"
    dotfiles_dest: "~/Projects"
    dotfiles_home: "~"
    dotfiles_files:
      - ".bashrc"
      - ".tmux.conf"
      - ".config/mpv/config"
      - ".config/gtk-3.0/gtk.css"
      - "bin"
      - ".local/share/applications/emacsclient.desktop"
      - ".local/share/applications/org-protocol.desktop"
  tasks:
    - name: Clone dotfiles
      git:
        repo: "{{ dotfiles_repo }}"
        version: "{{ dotfiles_branch }}"
        dest: "{{ dotfiles_dest }}/{{ dotfiles_name }}"
        clone: no
      tags:
        - dotfiles

    - name: Backup default dotfiles
      copy:
        src: "{{ dotfiles_home }}/{{ item }}"
        dest: "{{ dotfiles_home }}/{{ item }}.backup"
        force: no
      with_items: "{{ dotfiles_files }}"
      ignore_errors: yes
      tags:
        - dotfiles
        - backup

    - name: Prepare dotfiles destination
      file:
        path: "{{ (dotfiles_home ~ '/' ~ item) | dirname }}"
        state: directory
      with_items: "{{ dotfiles_files }}"
      tags:
        - dotfiles

    - name: Install dotfiles
      file:
        src: "{{ dotfiles_dest }}/{{ dotfiles_name }}/{{ item }}"
        dest: "{{ dotfiles_home }}/{{ item }}"
        state: link
        force: yes
      with_items: "{{ dotfiles_files }}"
      tags:
        - dotfiles

Add desktop-files to dotfile list
Add desktop-files to dotfile list
