- hosts: localhost
  tasks:

#  Need ansible 2.9+ for following to work
#  - name: Install Flatpak Pinta
#    community.general.flatpak:
#      name: com.github.PintaProject.Pinta
#      state: present
#    become: true

  - name: System details
    debug:
      msg: "{{ ansible_facts['lsb']['release'] }}"

  - name: Install Apt Packages for Productivity
    become: yes
    apt:
      state: present
      name:
        - gparted
        - mkvtoolnix-gui

  - name: Install Apt Packages for Productivity
    become: yes
    apt:
      state: present
      name:
        - kdenlive
    tags:
      - video
      - never

  - name: Install Apt Packages for Productivity Release 20 and above
    become: yes
    apt:
      state: present
      name:
        - peek
    when: ansible_facts['lsb']['release'] > "20.00"
    tags:
      - video
      - never

  - name: Flatpak Install OBS Studio
    command: flatpak install --assumeyes flathub com.obsproject.Studio
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/com.obsproject.Studio
    tags:
      - video
      - never

  - name: Flatpak Install Pinta
    become: yes
    command: flatpak install --assumeyes flathub com.github.PintaProject.Pinta
    args:
      creates: /home/{{ ansible_env.USER }}/Desktop/com.github.PintaProject.Pinta.desktop
    tags:
      - draw
      - never

  - name: Flatpak Install Draw.io
    command: flatpak install --assumeyes flathub com.jgraph.drawio.desktop
    args:
      creates: /home/{{ ansible_env.USER }}/Desktop/com.jgraph.drawio.desktop.desktop
    tags:
      - draw
      - never

  - name: Flatpak Install Geeqie
    command: flatpak install --assumeyes flathub org.geeqie.Geeqie
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/org.geeqie.Geeqie
    tags:
      - photo
      - never

  - name: Flatpak Install Upscaler
    command: flatpak install --assumeyes flathub io.gitlab.theevilskeleton.Upscaler
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/io.gitlab.theevilskeleton.Upscaler
    tags:
      - photo
      - never

  - name: Flatpak Install CherryTree
    command: flatpak install --assumeyes flathub com.giuspen.cherrytree
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/com.giuspen.cherrytree
    tags:
      - notes
      - never

  - name: Flatpak Install Simplenote
    command: flatpak install --assumeyes flathub com.simplenote.Simplenote
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/com.simplenote.Simplenote
    tags:
      - notes
      - never

  - name: Flatpak Install OnlyOffice
    command: flatpak install --assumeyes flathub org.onlyoffice.desktopeditors
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/org.onlyoffice.desktopeditors
    tags:
      - office
      - never

  - name: Flatpak Install FSearch
    become: yes
    command: flatpak install --assumeyes flathub io.github.cboxdoerfer.FSearch
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/io.github.cboxdoerfer.FSearch
    tags:
      - search
      - never

  - name: Flatpak Install Detwinner
    become: yes
    command: flatpak install --assumeyes flathub com.neatdecisions.Detwinner
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/com.neatdecisions.Detwinner
    tags:
      - search
      - never

  - name: Flatpak Install Peazip
    become: yes
    command: flatpak install --assumeyes flathub io.github.peazip.PeaZip
    args:
      creates: /home/{{ ansible_env.USER }}/.var/app/io.github.peazip.PeaZip
    tags:
      - search
      - never


