From cd787de1dc005eeec4cfb7c55fda1498908b5386 Mon Sep 17 00:00:00 2001
From: freezed <git-expect-noreply@freezed.me>
Date: Sun, 4 Dec 2022 01:21:34 +0100
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Reorganise=20packages=20TODO=20flat?=
 =?UTF-8?q?pack=20improves?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 tasks/apt.yml         | 64 +++++++++++++++++++++++++------------------
 tasks/vars/Debian.yml |  2 ++
 tasks/vars/Gnome.yml  |  2 ++
 tasks/vars/Mate.yml   |  2 ++
 tasks/vars/Ubuntu.yml |  5 +++-
 tasks/vars/main.yml   | 44 +++++++++++++++++------------
 6 files changed, 74 insertions(+), 45 deletions(-)

diff --git a/tasks/apt.yml b/tasks/apt.yml
index 16cd3fd..336aced 100644
--- a/tasks/apt.yml
+++ b/tasks/apt.yml
@@ -18,10 +18,10 @@
       when: "'mate' in group_names"
       ansible.builtin.include_vars: "Mate.yml"
 
-    - name: SNAP  | remove snap packages
-      when: snap_uninstall_pkg is defined
-      community.general.snap:
-        name: "{{ snap_uninstall_pkg }}"
+    - name: APT | uninstall packages
+      when: inventory_hostname not in groups.workstat
+      ansible.builtin.apt:
+        pkg: "{{ lookup('flattened', base_uninstall_pkg, os_uninstall_pkg) }}"
         state: absent
 
     - name: APT | install base & os packages
@@ -32,33 +32,26 @@
         state: present
         update_cache: true
 
+    - name: SNAP  | remove snap packages
+      when: snap_uninstall_pkg is defined
+      community.general.snap:
+        name: "{{ snap_uninstall_pkg }}"
+        state: absent
+
     - name: FLATPAK | add remote
+      when: inventory_hostname in groups.station
       community.general.flatpak_remote:
         name: flathub
         flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo
         state: present
-      register: flatpak_repo
 
     - name: FLATPAK | add packages
+      when: inventory_hostname in groups.station
       community.general.flatpak:
         name: com.brave.Browser
         state: present
         remote: flathub
 
-    - name: SIGNAL | add key to keyring
-      when: inventory_hostname in groups.station
-      ansible.builtin.apt_key:
-        url: https://updates.signal.org/desktop/apt/keys.asc
-        keyring: /usr/share/keyrings/signal-desktop-keyring.gpg
-        state: present
-
-    - name: SIGNAL | add apt repository
-      when: inventory_hostname in groups.station
-      ansible.builtin.apt_repository:
-        filename: signal-desktop
-        repo: deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main
-        state: present
-
     - name: APT | install workstation packages
       when: inventory_hostname in groups.station
       ansible.builtin.apt:
@@ -68,16 +61,28 @@
         state: present
         update_cache: true
 
-    - name: APT | uninstall packages
-      ansible.builtin.apt:
-        pkg: "{{ lookup('flattened', base_uninstall_pkg, os_uninstall_pkg) }}"
-        state: absent
-      register: flatpak_repo
-
-    - name: APT | upgrade all packages to the latest version
+    - name: APT | install develstation packages
+      when: inventory_hostname in groups.workstat
       ansible.builtin.apt:
+        cache_valid_time: 3600
         force_apt_get: yes
-        upgrade: safe
+        pkg: "{{ lookup('flattened', workstat_pkg, workstat_os_pkg, workstat_wm_pkg) }}"
+        state: present
+        update_cache: true
+
+    - name: APT | add SIGNAL key to keyring
+      when: inventory_hostname in groups.station
+      ansible.builtin.apt_key:
+        url: https://updates.signal.org/desktop/apt/keys.asc
+        keyring: /usr/share/keyrings/signal-desktop-keyring.gpg
+        state: present
+
+    - name: APT | add SIGNAL apt repository
+      when: inventory_hostname in groups.station
+      ansible.builtin.apt_repository:
+        filename: signal-desktop
+        repo: deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main
+        state: present
 
     - name: APT | install .deb packages
       when: inventory_hostname in groups.station
@@ -87,6 +92,11 @@
         - https://flavio.tordini.org/files/minitube/minitube.deb
         - https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.deb
 
+    - name: APT | upgrade all packages to the latest version
+      ansible.builtin.apt:
+        force_apt_get: yes
+        upgrade: safe
+
     - name: APT | remove useless packages from the cache
       ansible.builtin.apt:
         force_apt_get: yes
diff --git a/tasks/vars/Debian.yml b/tasks/vars/Debian.yml
index 5426291..047627b 100644
--- a/tasks/vars/Debian.yml
+++ b/tasks/vars/Debian.yml
@@ -4,5 +4,7 @@ os_pkg: []
 
 os_uninstall_pkg: []
 
+workstat_os_pkg: []
+
 station_os_pkg:
   - firefox-esr-l10n-fr
diff --git a/tasks/vars/Gnome.yml b/tasks/vars/Gnome.yml
index e743f22..0e3de01 100644
--- a/tasks/vars/Gnome.yml
+++ b/tasks/vars/Gnome.yml
@@ -4,3 +4,5 @@ station_wm_pkg:
   - gnome-tweaks
   - nautilus-image-converter
   - nautilus-nextcloud
+
+workstat_wm_pkg: []
diff --git a/tasks/vars/Mate.yml b/tasks/vars/Mate.yml
index 4fb645d..a924789 100644
--- a/tasks/vars/Mate.yml
+++ b/tasks/vars/Mate.yml
@@ -3,3 +3,5 @@
 station_wm_pkg:
   - mate-tweak
   - caja-nextcloud
+
+workstat_wm_pkg: []
diff --git a/tasks/vars/Ubuntu.yml b/tasks/vars/Ubuntu.yml
index e3ddb0e..ac55928 100644
--- a/tasks/vars/Ubuntu.yml
+++ b/tasks/vars/Ubuntu.yml
@@ -6,6 +6,9 @@ os_uninstall_pkg:
   - thunderbird
   - chromium-browser-l10n
 
+workstat_os_pkg: []
+
 snap_uninstall_pkg: []
 
-station_os_pkg: []
+station_os_pkg:
+  - solaar
diff --git a/tasks/vars/main.yml b/tasks/vars/main.yml
index b046a1c..b50e778 100644
--- a/tasks/vars/main.yml
+++ b/tasks/vars/main.yml
@@ -1,33 +1,41 @@
 ---
 
 base_pkg:
+  - detox
+  - git
   - htop
   - keychain
   - locales
   - lynx
   - progress
   - python3-apt
+  - python3-venv
   - rsync
   - screen
   - sudo
-  - tmux
+  - tree
   - unattended-upgrades
+  - unrar-free
   - unzip
   - vim
   - wget
   - xkcdpass
+  - xz-utils
   - zsh
 
-base_uninstall_pkg: []
+base_uninstall_pkg:
+  - ansible
+  - geany
+  - make
+  - meld
+  - mhwaveedit
+  - pandoc
+  - sshpass
+  - torbrowser-launcher
+  - tmux
 
-station_pkg:
+workstat_pkg:
   - ansible
-  - cheese
-  - detox
-  - easytag
-  - evolution
-  - evolution-plugins
-  - flatpak
   - geany-plugin-addons
   - geany-plugin-extrasel
   - geany-plugin-git-changebar
@@ -36,6 +44,16 @@ station_pkg:
   - geany-plugin-spellcheck
   - geany-plugin-workbench
   - geany-plugin-xmlsnippets
+  - make
+  - meld
+  - mhwaveedit
+  - pandoc
+
+station_pkg:
+  - cheese
+  - evolution
+  - evolution-plugins
+  - flatpak
   - gimp
   - git
   - gnome-disk-utility
@@ -44,17 +62,10 @@ station_pkg:
   - hplip
   - jhead
   - keepassx
-  - make
-  - meld
-  - mhwaveedit
   - network-manager-gnome
   - nextcloud-desktop
-  - pandoc
   - pdftk
   - photocollage
-  - python3-venv
-  - sshpass
-  - tree
   - signal-desktop
   - simple-scan
   - soundconverter
@@ -62,4 +73,3 @@ station_pkg:
   - torbrowser-launcher
   - unrar-free
   - vlc
-  - xz-utils
-- 
GitLab