From b0c67f6131f3b60de2f933e6a12deac768c378c4 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 10 May 2022 23:27:19 +0200 Subject: [PATCH] Improved flatpak's ansible play and notes --- ansible/flatpak.configure.yml | 31 ++++++++++++++++++++++++++---- knowledge base/flatpak.md | 36 +++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/ansible/flatpak.configure.yml b/ansible/flatpak.configure.yml index 59ffa35..698fdeb 100644 --- a/ansible/flatpak.configure.yml +++ b/ansible/flatpak.configure.yml @@ -11,8 +11,11 @@ - pkg_mgr hosts: all vars: + flathub_enabled: true + flathub_method: user flathub_name: flathub flathub_url: https://flathub.org/repo/flathub.flatpakrepo + remotes: [] tasks: - when: ansible_system == 'Linux' tags: linux @@ -30,9 +33,29 @@ - configure - configuration block: - - name: Enable the Flathub remote for the system - tags: flathub + - name: Add flathub to the remotes + when: flathub_enabled + set_fact: + remotes: "{{ remotes + [ { 'name': flathub_name, 'method': flathub_method, 'url': flathub_url } ] }}" + - name: Enable system remotes + tags: + - remote + - remotes + - system + when: item.method == 'system' become: true community.general.flatpak_remote: - name: "{{ flathub_name }}" - flatpakrepo_url: "{{ flathub_url }}" + name: "{{ item.name }}" + flatpakrepo_url: "{{ item.url }}" + loop: "{{ remotes }}" + - name: Enable user remotes + tags: + - remote + - remotes + - user + when: item.method == 'user' + become: true + community.general.flatpak_remote: + name: "{{ item.name }}" + flatpakrepo_url: "{{ item.url }}" + loop: "{{ remotes }}" diff --git a/knowledge base/flatpak.md b/knowledge base/flatpak.md index 10b0164..0c286a8 100644 --- a/knowledge base/flatpak.md +++ b/knowledge base/flatpak.md @@ -3,18 +3,46 @@ ## TL;DR ```shell -# add the `flathub` remote +# List installed applications and runtimes. +flatpak list +flatpak list --app + +# List remotes. +flatpak remotes + +# Add remotes. flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo -# search for `vscode` +# Search for applications. flatpak search vscode -# install `vscode` +# Install applications. +flatpak install fedora org.stellarium.Stellarium flatpak install --user flathub com.visualstudio.code-oss +flatpak install https://flathub.org/repo/appstream/org.gimp.GIMP.flatpakref -# uninstall unused packages +# Run applications. +flatpak run org.gimp.GIMP + +# Update applications. +flatpak update + +# Uninstall applications. +flatpak uninstall org.stellarium.Stellarium flatpak uninstall --unused + +# Remove remotes. +flatpak remote-delete flathub + +# Fix inconsitencies. +flatpak repair + +# Reset applications' permissions. +flatpak permission-reset org.gimp.GIMP + +# List operations. +flatpak history ``` ## Further readings