refactor: reorganize Ansible tasks for better structure and include common package installations
All checks were successful
Nix Format Check / check-format (pull_request) Successful in 40s

This commit is contained in:
2025-01-22 15:11:58 +01:00
parent 596a3574df
commit c651722b73
20 changed files with 125 additions and 186 deletions

View File

@@ -0,0 +1,43 @@
- name: Import 1Password GPG key (RPM)
ansible.builtin.rpm_key:
key: https://downloads.1password.com/linux/keys/1password.asc
state: present
when: ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf"
- name: Import 1Password GPG key (APT)
ansible.builtin.apt_key:
url: https://downloads.1password.com/linux/keys/1password.asc
state: present
when: ansible_pkg_mgr == "apt"
- name: Add 1Password repository (RPM)
ansible.builtin.copy:
content: |
[1password]
name=1Password Stable Channel
baseurl=https://downloads.1password.com/linux/rpm/stable/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://downloads.1password.com/linux/keys/1password.asc
dest: /etc/yum.repos.d/1password.repo
mode: '0644'
when: ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf"
- name: Add 1Password repository (APT)
ansible.builtin.apt_repository:
repo: deb [arch=amd64] https://downloads.1password.com/linux/debian stable main
state: present
when: ansible_pkg_mgr == "apt"
- name: Install 1Password CLI (RPM)
ansible.builtin.package:
name: 1password-cli
state: present
when: ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf"
- name: Install 1Password CLI (APT)
ansible.builtin.package:
name: 1password-cli
state: present
when: ansible_pkg_mgr == "apt"

View File

@@ -0,0 +1,18 @@
- name: Check if Brave is installed
ansible.builtin.command: brave-browser --version
register: brave_check
changed_when: false
failed_when: false
- name: Download Brave Browser install script
ansible.builtin.get_url:
url: https://dl.brave.com/install.sh
dest: /tmp/install_brave.sh
mode: '0755'
when: brave_check.rc != 0
- name: Install Brave Browser
ansible.builtin.command: bash -c 'set -o pipefail && /tmp/install_brave.sh -y'
when: brave_check.rc != 0
args:
creates: /usr/bin/brave-browser

View File

@@ -0,0 +1,66 @@
- name: Add Flathub remote repository
community.general.flatpak_remote:
name: flathub
flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo
state: present
- name: Get list of installed Flatpaks
ansible.builtin.command: flatpak list --app --columns=application
register: installed_flatpaks
changed_when: false
- name: Define desired Flatpaks
ansible.builtin.set_fact:
desired_flatpaks:
- org.fkoehler.KTailctl
- org.mozilla.Thunderbird
- io.github.kukuruzka165.materialgram
- com.spotify.Client
- org.gnome.Extensions
- com.endlessnetwork.aqueducts
- com.tomjwatson.Emote
- io.github.openhv.OpenHV
- net.wz2100.wz2100
- com.github.k4zmu2a.spacecadetpinball
- com.usebottles.bottles
- io.github.shiftey.Desktop
- org.fedoraproject.MediaWriter
- com.github.tchx84.Flatseal
- de.haeckerfelix.Shortwave
- io.github.thetumultuousunicornofdarkness.cpu-x
- org.gnome.Crosswords
- com.github.wwmm.easyeffects
- dev.bragefuglseth.Keypunch
- org.onlyoffice.desktopeditors
- com.jeffser.Alpaca
- info.beyondallreason.bar
- io.gitlab.adhami3310.Impression
- org.prismlauncher.PrismLauncher
- com.logseq.Logseq
- io.ente.auth
- org.signal.Signal
- com.mardojai.ForgeSparks
- io.github.fastrizwaan.WineZGUI
- net.davidotek.pupgui2
- tv.plex.PlexDesktop
- com.mastermindzh.tidal-hifi
- io.github.flattool.Warehouse
- net.lutris.Lutris
- com.plexamp.Plexamp
- io.github.nokse22.Exhibit
- net.nokyan.Resources
- dev.zed.Zed
- com.discordapp.Discord
- com.valvesoftware.Steam
- name: Install/Upgrade Flatpak packages
community.general.flatpak:
name: "{{ item }}"
state: present
loop: "{{ desired_flatpaks }}"
- name: Remove undesired Flatpak packages
community.general.flatpak:
name: "{{ item }}"
state: absent
loop: "{{ installed_flatpaks.stdout_lines | difference(desired_flatpaks) }}"

View File

@@ -0,0 +1,2 @@
- name: Install Pano - Clipboard Manager
ansible.builtin.import_tasks: tasks/workstations/gnome-extensions/pano.yml

View File

@@ -0,0 +1,40 @@
- name: Check if Pano - Clipboard Manager is installed
ansible.builtin.stat:
path: "{{ ansible_user_dir }}/.local/share/gnome-shell/extensions/pano@elhan.io"
register: pano_check
- name: Create Pano - Clipboard Manager directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.local/share/gnome-shell/extensions/pano@elhan.io"
state: directory
mode: '0755'
when: not pano_check.stat.exists
# To update Pano, delete the existing directory and re-download the latest release
# Replace the URL with the latest release URL and rerun the playbook/dotf update
- name: Download Pano - Clipboard Manager
ansible.builtin.get_url:
url: https://github.com/oae/gnome-shell-pano/releases/download/v23-alpha3/pano@elhan.io.zip
dest: "{{ ansible_user_dir }}/.local/share/gnome-shell/extensions/pano@elhan.io/release.zip"
mode: '0644'
when: not pano_check.stat.exists
- name: Extract Pano - Clipboard Manager
ansible.builtin.unarchive:
src: "{{ ansible_user_dir }}/.local/share/gnome-shell/extensions/pano@elhan.io/release.zip"
dest: "{{ ansible_user_dir }}/.local/share/gnome-shell/extensions/pano@elhan.io/"
when: not pano_check.stat.exists
- name: Cleanup post Pan - Clipboard Manager installation
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.local/share/gnome-shell/extensions/pano@elhan.io/release.zip"
state: absent
when: not pano_check.stat.exists
- name: Notify user of required GNOME Shell extension reload
ansible.builtin.debug:
msg: >
Please reload GNOME Shell by pressing Alt + F2, typing 'r' and pressing Enter.
Then enable the Pano - Clipboard Manager extension in GNOME Tweaks.
Or on Wayland, log out and back in.
when: not pano_check.stat.exists

View File

@@ -0,0 +1,28 @@
- name: Import Microsoft GPG key
ansible.builtin.rpm_key:
key: https://packages.microsoft.com/keys/microsoft.asc
state: present
- name: Add VSCode repository
ansible.builtin.copy:
content: |
[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
dest: /etc/yum.repos.d/vscode.repo
mode: '0644'
- name: Check if VSCode is installed
ansible.builtin.command: code --version
register: vscode_check
changed_when: false
failed_when: false
- name: Install VSCode
ansible.builtin.package:
name: code
state: present
when: vscode_check.rc != 0

View File

@@ -0,0 +1,30 @@
- name: Include VSCode tasks
ansible.builtin.import_tasks: tasks/workstations/vscode.yml
become: true
- name: Include Brave tasks
ansible.builtin.import_tasks: tasks/workstations/brave.yml
become: true
- name: Include 1Password tasks
ansible.builtin.import_tasks: tasks/workstations/1password.yml
become: true
- name: Include GNOME Extensions tasks
ansible.builtin.import_tasks: tasks/workstations/gnome-extensions.yml
- name: Include flatpaks tasks
ansible.builtin.import_tasks: tasks/workstations/flatpaks.yml
- name: Ensure common packages are installed
ansible.builtin.package:
name:
# Flatpak package manager, used for various applications
- flatpak
# Required by Pano - Clipboard Manager (GNOME Extension)
- libgda
- libgda-sqlite
# Required by Bubblemail - Email Notifications (GNOME Extension)
- bubblemail
state: present
become: true