Refactor workstation to Fedora WSL target

This commit is contained in:
Fabio Scotto di Santolo
2026-08-28 11:41:14 +02:00
parent 3f0654a4bd
commit a6a58245ff
18 changed files with 48 additions and 953 deletions

View File

@@ -12,12 +12,6 @@ fedora_packages_base:
- ripgrep
fedora_manage_docker_repo: true
fedora_manage_google_chrome_repo: true
fedora_manage_intellij_repo: true
fedora_manage_vscode_repo: true
fedora_intellij_copr_owner: coder966
fedora_intellij_copr_project: intellij-idea-ultimate
fedora_intellij_package_name: intellij-idea-ultimate
fedora_emacs_packages:
- emacs-pgtk
@@ -53,7 +47,7 @@ fedora_dotfiles:
workstation_firewall_backend: firewalld
fedora_workstation_dev_packages:
fedora_dev_packages:
- croc
- distrobox
- gnupg
@@ -62,35 +56,5 @@ fedora_workstation_dev_packages:
- openssh-clients
- shellcheck
workstation_host_linux_packages_fedora:
- code
- croc
- firewall-config
- gnome-extensions-app
- gnome-shell-extension-appindicator
- gnome-shell-extension-just-perfection
- gnome-shell-extension-no-overview
- gnome-tweaks
- libreoffice
- meld
- NetworkManager-openconnect-gnome
- pcsc-lite
- pinentry-gnome3
- podman
- podman-compose
- rclone
- yubikey-manager
fedora_flatpak_remote_name: flathub
fedora_flatpak_remote_url: https://dl.flathub.org/repo/flathub.flatpakrepo
workstation_flatpak_remote_name: "{{ fedora_flatpak_remote_name }}"
workstation_flatpak_remote_url: "{{ fedora_flatpak_remote_url }}"
workstation_flatpak_packages:
- com.getpostman.Postman
- com.spotify.Client
- com.github.jeromerobert.pdfarranger
- com.github.xournalpp.xournalpp
- io.dbeaver.DBeaverCommunity
- org.mozilla.Thunderbird
- org.telegram.desktop

View File

@@ -1,14 +1,6 @@
---
emacs_enabled: true
workstation_dev_packages:
- distrobox
- gnupg
- gpg-agent
- libfido2-1
- openssh-client
- shellcheck
workstation_user_directories:
- path: "{{ user_home }}/.config"
mode: "0755"

View File

@@ -3,25 +3,10 @@ enabled_services:
- docker
workstation_dev_wsl_packages:
- lazygit
- pinentry-curses
- python3-pip
- tmux
workstation_dev_wsl_excluded_packages:
- alacritty
- pcscd
- pinentry-gnome3
- podman
- podman-compose
- ufw
- yubikey-manager
workstation_is_wsl: true
workstation_manage_google_chrome: false
workstation_manage_croc: true
workstation_croc_version: v11.0.3
workstation_removed_snap_packages: []
workstation_snap_packages: []
workstation_dev_wsl_python_packages: []
workstation_wsl_systemd_enabled: true
workstation_dev_wsl_dotfiles:
- src: .gnupg/gpg-agent.conf

View File

@@ -1,47 +0,0 @@
---
enabled_services:
- docker
workstation_dev_wsl_packages:
- lazygit
- pinentry-curses
- python3-pip
workstation_dev_wsl_excluded_packages:
- alacritty
- pcscd
- pinentry-gnome3
- podman
- podman-compose
- ufw
- yubikey-manager
workstation_is_wsl: true
workstation_manage_google_chrome: false
<<<<<<< HEAD
workstation_removed_snap_packages: []
workstation_snap_packages:
- name: glab
classic: true
workstation_dev_wsl_python_packages: []
||||||| parent of cb83ed1 (Update gitconfig on WSL)
workstation_removed_snap_packages: []
workstation_snap_packages:
- name: glab
classic: true
workstation_dev_wsl_python_packages:
- pypsrp
- pyspnego
=======
workstation_manage_glab: true
workstation_glab_version: "1.103.0"
workstation_removed_snap_packages:
- glab
workstation_snap_packages: []
workstation_dev_wsl_python_packages:
- pypsrp
- pyspnego
>>>>>>> cb83ed1 (Update gitconfig on WSL)
workstation_wsl_systemd_enabled: true
workstation_dev_wsl_dotfiles:
- src: .gnupg/gpg-agent.conf
dest: .gnupg/gpg-agent.conf
mode: "0600"

View File

@@ -1,11 +0,0 @@
---
# Fedora WSL mirrors the Ubuntu WSL development profile without installing
# alternative application runtimes.
fedora_excluded_packages:
- flatpak
- lazygit
fedora_removed_packages:
- flatpak
- snapd
fedora_manage_lazygit: true
fedora_lazygit_version: 0.64.1

View File

@@ -1,75 +0,0 @@
---
emacs_enabled: true
workstation_host_linux_packages:
- croc
- gnome-shell-extension-manager
- gnome-shell-extensions
- gnome-tweaks
- gufw
- libreoffice
- meld
- network-manager-openconnect-gnome
- pcscd
- pinentry-gnome3
- podman
- podman-compose
- yubikey-manager
workstation_host_linux_dotfiles:
- src: .gnupg/gpg-agent.conf
dest: .gnupg/gpg-agent.conf
mode: "0600"
workstation_firewall_backend: ufw
workstation_manage_google_chrome: true
workstation_removed_snap_packages:
- firefox
workstation_snap_packages:
- name: intellij-idea-ultimate
classic: true
channel: latest/stable
- name: postman
classic: false
channel: latest/stable
- name: thunderbird
classic: false
channel: latest/stable
- name: code
classic: true
channel: latest/stable
- name: xournalpp
classic: false
channel: latest/stable
- name: pdfarranger
classic: false
channel: latest/stable
- name: spotify
classic: false
channel: latest/stable
- name: telegram-desktop
classic: false
channel: latest/stable
- name: dbeaver-ce
classic: true
channel: latest/stable
workstation_gnome_extensions:
- id: 9308
uuid: bluetooth-battery-monitor@v8v88v8v88.com
version_tag: 68559
enabled: true
- id: 1401
uuid: bluetooth-quick-connect@bjarosze.gmail.com
version_tag: 65323
enabled: true
- id: 6099
uuid: paperwm@paperwm.github.com
version_tag: 68525
enabled: true
workstation_disabled_gnome_extensions:
- tiling-assistant@ubuntu.com
- ubuntu-dock@ubuntu.com

View File

@@ -1,6 +0,0 @@
---
hostname: deadalus-fedora-wsl
workstation_wsl_windows_user_home: /mnt/c/Users/FABIOSCOTTODISANTOLO
host_packages: []
host_enabled_services: []

View File

@@ -1,6 +0,0 @@
---
hostname: deadalus-wsl
workstation_wsl_windows_user_home: /mnt/c/Users/FABIOSCOTTODISANTOLO
host_packages: []
host_enabled_services: []

View File

@@ -0,0 +1,13 @@
---
hostname: deadalus
workstation_wsl_windows_user_home: /mnt/c/Users/FABIOSCOTTODISANTOLO
host_packages: []
host_enabled_services: []
# Fedora WSL must not receive alternative application runtimes.
fedora_excluded_packages:
- flatpak
fedora_removed_packages:
- flatpak
- snapd

View File

@@ -10,7 +10,7 @@ all:
ansible_connection: local
nymph:
ansible_connection: local
deadalus-fedora-wsl:
deadalus:
ansible_connection: local
platform_freebsd:
@@ -55,18 +55,12 @@ all:
ubuntu:
children:
workstation_dev_wsl_ubuntu:
ubuntu_server:
workstation:
children:
workstation_host:
workstation_dev:
workstation_host:
children:
workstation_host_linux:
workstation_dev:
children:
workstation_dev_fedora:
@@ -76,29 +70,14 @@ all:
children:
ubuntu_server:
fedora_workstation:
hosts: {}
workstation_host_linux:
hosts: {}
workstation_dev_fedora:
children:
workstation_dev_wsl_fedora:
workstation_dev_wsl:
children:
workstation_dev_wsl_ubuntu:
workstation_dev_wsl_fedora:
workstation_dev_wsl_ubuntu:
hosts:
deadalus-wsl:
deadalus:
ansible_connection: local
workstation_dev_wsl_fedora:
workstation_dev_wsl:
hosts:
deadalus-fedora-wsl:
deadalus:
ansible_connection: local
ubuntu_server:

View File

@@ -25,47 +25,6 @@
- "'workstation_dev_fedora' in group_names"
- fedora_manage_docker_repo | default(false)
- name: Configure Google Chrome repository on Fedora
tags: [packages]
ansible.builtin.yum_repository:
name: google-chrome
description: Google Chrome
baseurl: "https://dl.google.com/linux/chrome/rpm/stable/$basearch"
enabled: true
gpgcheck: true
gpgkey: https://dl.google.com/linux/linux_signing_key.pub
state: present
when:
- workstation_manage_google_chrome | default(false)
- fedora_manage_google_chrome_repo | default(false)
- name: Configure Visual Studio Code repository on Fedora
tags: [packages, vscode]
ansible.builtin.yum_repository:
name: vscode
description: Visual Studio Code
baseurl: https://packages.microsoft.com/yumrepos/vscode
enabled: true
gpgcheck: true
gpgkey: https://packages.microsoft.com/keys/microsoft.asc
state: present
when:
- "'workstation_host_linux' in group_names"
- fedora_manage_vscode_repo | default(false)
- name: Configure IntelliJ IDEA COPR repository on Fedora
tags: [packages]
ansible.builtin.get_url:
url: >-
https://copr.fedorainfracloud.org/coprs/{{ fedora_intellij_copr_owner }}/{{ fedora_intellij_copr_project }}/repo/fedora-{{ ansible_facts['distribution_major_version'] }}/{{ fedora_intellij_copr_owner }}-{{ fedora_intellij_copr_project }}-fedora-{{ ansible_facts['distribution_major_version'] }}.repo
dest: /etc/yum.repos.d/{{ fedora_intellij_copr_owner }}-{{ fedora_intellij_copr_project }}-fedora-{{ ansible_facts['distribution_major_version'] }}.repo
owner: root
group: root
mode: "0644"
when:
- "'workstation_host_linux' in group_names"
- fedora_manage_intellij_repo | default(false)
- name: Refresh dnf package metadata
tags: [packages]
ansible.builtin.dnf:
@@ -84,11 +43,6 @@
if 'workstation_dev_fedora' in group_names
else []
)
+ (
['google-chrome-stable']
if workstation_manage_google_chrome | default(false)
else []
)
+ (profile_packages | default([]))
+ (
(fedora_desktop_packages | default([]))
@@ -103,7 +57,7 @@
else []
)
+ (
(fedora_workstation_dev_packages | default(workstation_dev_packages | default([])))
(fedora_dev_packages | default([]))
if 'workstation_dev_fedora' in group_names
else []
)
@@ -112,19 +66,6 @@
if 'workstation_dev_wsl' in group_names
else []
)
+ (
(workstation_host_linux_packages_fedora | default(workstation_host_linux_packages | default([])))
if 'workstation_host_linux' in group_names
else []
)
+ (
[fedora_intellij_package_name]
if (
'workstation_host_linux' in group_names
and fedora_manage_intellij_repo | default(false)
)
else []
)
+ (host_packages | default([]))
)
| difference(fedora_excluded_packages | default([]))
@@ -139,100 +80,6 @@
state: absent
when: (fedora_removed_packages | default([])) | length > 0
- name: Ensure architecture is supported for LazyGit release
tags: [packages]
ansible.builtin.fail:
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for LazyGit release"
when:
- fedora_manage_lazygit | default(false)
- ansible_facts['architecture'] not in ['x86_64', 'aarch64', 'arm64']
- name: Read installed LazyGit version
tags: [packages]
ansible.builtin.command: /usr/local/bin/lazygit --version
register: fedora_lazygit_version_check
changed_when: false
failed_when: false
check_mode: false
when: fedora_manage_lazygit | default(false)
- name: Ensure temporary LazyGit extraction directory is absent
tags: [packages]
ansible.builtin.file:
path: "/tmp/lazygit_{{ fedora_lazygit_version }}"
state: absent
when:
- fedora_manage_lazygit | default(false)
- fedora_lazygit_version not in (fedora_lazygit_version_check.stdout | default(''))
- name: Create temporary LazyGit extraction directory
tags: [packages]
ansible.builtin.file:
path: "/tmp/lazygit_{{ fedora_lazygit_version }}"
state: directory
owner: root
group: root
mode: "0755"
when:
- fedora_manage_lazygit | default(false)
- fedora_lazygit_version not in (fedora_lazygit_version_check.stdout | default(''))
- name: Download LazyGit release archive
tags: [packages]
ansible.builtin.get_url:
url: >-
https://github.com/jesseduffield/lazygit/releases/download/v{{ fedora_lazygit_version }}/lazygit_{{
fedora_lazygit_version }}_Linux_{{
'x86_64' if ansible_facts['architecture'] == 'x86_64'
else 'arm64'
}}.tar.gz
dest: "/tmp/lazygit_{{ fedora_lazygit_version }}.tar.gz"
mode: "0644"
when:
- fedora_manage_lazygit | default(false)
- fedora_lazygit_version not in (fedora_lazygit_version_check.stdout | default(''))
- name: Extract LazyGit release archive
tags: [packages]
ansible.builtin.unarchive:
src: "/tmp/lazygit_{{ fedora_lazygit_version }}.tar.gz"
dest: "/tmp/lazygit_{{ fedora_lazygit_version }}"
remote_src: true
when:
- fedora_manage_lazygit | default(false)
- fedora_lazygit_version not in (fedora_lazygit_version_check.stdout | default(''))
- name: Install LazyGit binary
tags: [packages]
ansible.builtin.copy:
src: "/tmp/lazygit_{{ fedora_lazygit_version }}/lazygit"
dest: /usr/local/bin/lazygit
owner: root
group: root
mode: "0755"
remote_src: true
when:
- fedora_manage_lazygit | default(false)
- fedora_lazygit_version not in (fedora_lazygit_version_check.stdout | default(''))
- name: Remove downloaded LazyGit archive
tags: [packages]
ansible.builtin.file:
path: "/tmp/lazygit_{{ fedora_lazygit_version }}.tar.gz"
state: absent
when:
- fedora_manage_lazygit | default(false)
- fedora_lazygit_version not in (fedora_lazygit_version_check.stdout | default(''))
- name: Remove temporary LazyGit extraction directory
tags: [packages]
ansible.builtin.file:
path: "/tmp/lazygit_{{ fedora_lazygit_version }}"
state: absent
when:
- fedora_manage_lazygit | default(false)
- fedora_lazygit_version not in (fedora_lazygit_version_check.stdout | default(''))
- name: Add user to docker group
tags: [packages]
ansible.builtin.user:
@@ -262,11 +109,6 @@
(
(fedora_flatpak_packages | default([]))
+ (host_flatpak_packages | default([]))
+ (
(workstation_flatpak_packages | default([]))
if 'workstation_host_linux' in group_names
else []
)
)
| unique
}}

View File

@@ -1,9 +1,4 @@
---
- name: Gather installed package facts
tags: [packages]
ansible.builtin.package_facts:
manager: auto
- name: Copy Ubuntu dotfiles
tags: [dotfiles, dotfiles:common]
ansible.builtin.copy:
@@ -16,75 +11,6 @@
loop_control:
label: "{{ item.dest }}"
- name: Ensure architecture is supported for Google Chrome
tags: [packages]
ansible.builtin.fail:
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for Google Chrome stable package"
when:
- workstation_manage_google_chrome | default(false)
- ansible_facts['architecture'] != 'x86_64'
- name: Download Google Chrome Debian package
tags: [packages]
ansible.builtin.get_url:
url: https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dest: /tmp/google-chrome-stable_current_amd64.deb
mode: "0644"
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Install Google Chrome from downloaded Debian package
tags: [packages]
ansible.builtin.apt:
deb: /tmp/google-chrome-stable_current_amd64.deb
state: present
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Remove downloaded Google Chrome Debian package
tags: [packages]
ansible.builtin.file:
path: /tmp/google-chrome-stable_current_amd64.deb
state: absent
when:
- workstation_manage_google_chrome | default(false)
- "'google-chrome-stable' not in (ansible_facts.packages | default({}))"
- name: Download glab Debian package
tags: [packages]
ansible.builtin.get_url:
url: >-
https://gitlab.com/gitlab-org/cli/-/releases/v{{ workstation_glab_version }}/downloads/glab_{{ workstation_glab_version }}_linux_{{
'amd64' if ansible_facts['architecture'] == 'x86_64'
else 'arm64' if ansible_facts['architecture'] in ['aarch64', 'arm64']
else ansible_facts['architecture']
}}.deb
dest: "/tmp/glab_{{ workstation_glab_version }}.deb"
mode: "0644"
when:
- workstation_manage_glab | default(false)
- ansible_facts.packages['glab'] is not defined or ansible_facts.packages['glab'][0].version != workstation_glab_version
- name: Install glab from downloaded Debian package
tags: [packages]
ansible.builtin.apt:
deb: "/tmp/glab_{{ workstation_glab_version }}.deb"
state: present
when:
- workstation_manage_glab | default(false)
- ansible_facts.packages['glab'] is not defined or ansible_facts.packages['glab'][0].version != workstation_glab_version
- name: Remove downloaded glab Debian package
tags: [packages]
ansible.builtin.file:
path: "/tmp/glab_{{ workstation_glab_version }}.deb"
state: absent
when:
- workstation_manage_glab | default(false)
- ansible_facts.packages['glab'] is not defined or ansible_facts.packages['glab'][0].version != workstation_glab_version
- name: Ensure Docker apt keyrings directory exists
tags: [packages]
ansible.builtin.file:
@@ -141,25 +67,8 @@
if (emacs_enabled | default(false) | bool)
else []
)
+ (workstation_dev_packages | default([]))
+ (
(workstation_host_linux_packages | default([]))
if 'workstation_host_linux' in group_names
else []
)
+ (
(workstation_dev_wsl_packages | default([]))
if 'workstation_dev_wsl' in group_names
else []
)
+ (desktop_common_packages | default([]))
+ (host_packages | default([]))
)
| difference(
(workstation_dev_wsl_excluded_packages | default([]))
if 'workstation_dev_wsl' in group_names
else []
)
| unique
}}
state: present
@@ -171,127 +80,3 @@
groups: docker
append: true
when: (ubuntu_docker_packages | default([])) | length > 0
- name: Ensure architecture is supported for croc GitHub release
tags: [packages]
ansible.builtin.fail:
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for croc GitHub release"
when:
- workstation_manage_croc | default(false)
- ansible_facts['architecture'] not in ['x86_64', 'aarch64', 'arm64']
- name: Read installed croc version
tags: [packages]
ansible.builtin.command: /usr/local/bin/croc --version
register: croc_version_check
changed_when: false
failed_when: false
check_mode: false
when: workstation_manage_croc | default(false)
- name: Ensure temporary croc extraction directory is absent
tags: [packages]
ansible.builtin.file:
path: "/tmp/croc_{{ workstation_croc_version }}"
state: absent
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Create temporary croc extraction directory
tags: [packages]
ansible.builtin.file:
path: "/tmp/croc_{{ workstation_croc_version }}"
state: directory
owner: root
group: root
mode: "0755"
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Download croc GitHub release archive
tags: [packages]
ansible.builtin.get_url:
url: >-
{{
'https://github.com/schollz/croc/releases/download/'
~ workstation_croc_version
~ '/croc_'
~ workstation_croc_version
~ '_Linux-'
~ (
'64bit' if ansible_facts['architecture'] == 'x86_64'
else 'ARM64' if ansible_facts['architecture'] in ['aarch64', 'arm64']
else ansible_facts['architecture']
)
~ '.tar.gz'
}}
dest: "/tmp/croc_{{ workstation_croc_version }}.tar.gz"
mode: "0644"
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Extract croc GitHub release archive
tags: [packages]
ansible.builtin.unarchive:
src: "/tmp/croc_{{ workstation_croc_version }}.tar.gz"
dest: "/tmp/croc_{{ workstation_croc_version }}"
remote_src: true
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Install croc binary
tags: [packages]
ansible.builtin.copy:
src: "/tmp/croc_{{ workstation_croc_version }}/croc"
dest: /usr/local/bin/croc
owner: root
group: root
mode: "0755"
remote_src: true
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Remove downloaded croc archive
tags: [packages]
ansible.builtin.file:
path: "/tmp/croc_{{ workstation_croc_version }}.tar.gz"
state: absent
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Remove temporary croc extraction directory
tags: [packages]
ansible.builtin.file:
path: "/tmp/croc_{{ workstation_croc_version }}"
state: absent
when:
- workstation_manage_croc | default(false)
- workstation_croc_version not in (croc_version_check.stdout | default(''))
- name: Remove workstation snap packages
tags: [packages]
community.general.snap:
name: "{{ item }}"
state: absent
loop: "{{ workstation_removed_snap_packages | default([]) }}"
loop_control:
label: "{{ item }}"
when: (workstation_removed_snap_packages | default([])) | length > 0
- name: Install workstation snap packages
tags: [packages]
community.general.snap:
name: "{{ item.name }}"
classic: "{{ item.classic | default(false) }}"
channel: "{{ item.channel | default(omit) }}"
state: present
loop: "{{ workstation_snap_packages | default([]) }}"
loop_control:
label: "{{ item.name }}"
when: (workstation_snap_packages | default([])) | length > 0

View File

@@ -76,15 +76,6 @@
register: workstation_wsl_systemd_config
when: workstation_wsl_systemd_enabled | default(false)
- name: Install WSL Python packages for Windows remoting
tags: [packages]
ansible.builtin.pip:
name: "{{ workstation_dev_wsl_python_packages | default([]) }}"
executable: pip3
extra_args: --break-system-packages
state: present
when: (workstation_dev_wsl_python_packages | default([])) | length > 0
- name: Note when WSL must be restarted
tags: [packages, services]
ansible.builtin.debug:

View File

@@ -1,262 +0,0 @@
---
- name: Copy workstation host Linux dotfiles
tags: [dotfiles, dotfiles:workstation, gnome]
ansible.builtin.copy:
src: "{{ playbook_dir }}/../dotfiles/workstation_host_linux/{{ item.src }}"
dest: "{{ user_home }}/{{ item.dest }}"
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "{{ item.mode }}"
loop: "{{ workstation_host_linux_dotfiles | default([]) }}"
loop_control:
label: "{{ item.dest }}"
- name: Ensure GNOME extension directories exist
tags: [packages, gnome]
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0755"
loop:
- "{{ user_home }}/.cache/gnome-shell/extensions"
- "{{ user_home }}/.local/share/gnome-shell/extensions"
- name: Gather workstation user account data
tags: [packages, gnome]
ansible.builtin.getent:
database: passwd
key: "{{ username }}"
- name: Set workstation GNOME session environment
tags: [packages, gnome]
ansible.builtin.set_fact:
workstation_user_uid: "{{ ansible_facts.getent_passwd[username][1] }}"
workstation_gnome_extension_dir: "{{ user_home }}/.cache/gnome-shell/extensions"
workstation_gnome_environment:
HOME: "{{ user_home }}"
XDG_RUNTIME_DIR: "/run/user/{{ ansible_facts.getent_passwd[username][1] }}"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ ansible_facts.getent_passwd[username][1] }}/bus"
- name: Read current workstation GNOME managed settings
tags: [gnome]
ansible.builtin.command:
argv:
- gsettings
- get
- "{{ item.schema }}{{ ':' ~ item.path if item.path is defined else '' }}"
- "{{ item.key }}"
become_user: "{{ username }}"
environment: "{{ workstation_gnome_environment }}"
loop: "{{ workstation_gnome_managed_settings | default([]) }}"
loop_control:
label: >-
{{ item.schema }}{{ ':' ~ item.path if item.path is defined else '' }} {{ item.key }}
register: workstation_gnome_managed_settings_current
changed_when: false
- name: Apply workstation GNOME managed settings
tags: [gnome]
ansible.builtin.command:
argv:
- gsettings
- set
- "{{ item.item.schema }}{{ ':' ~ item.item.path if item.item.path is defined else '' }}"
- "{{ item.item.key }}"
- "{{ item.item.value }}"
become_user: "{{ username }}"
environment: "{{ workstation_gnome_environment }}"
loop: "{{ workstation_gnome_managed_settings_current.results | default([]) }}"
loop_control:
label: >-
{{ item.item.schema }}{{ ':' ~ item.item.path if item.item.path is defined else '' }} {{ item.item.key }}
changed_when: true
when: item.stdout | trim != item.item.value
- name: Apply workstation GNOME extension dconf settings
tags: [gnome]
ansible.builtin.command:
argv:
- dconf
- write
- "{{ item.path }}{{ item.key }}"
- "{{ item.value }}"
become_user: "{{ username }}"
loop: "{{ workstation_gnome_extension_dconf_settings | default([]) }}"
loop_control:
label: "{{ item.path }}{{ item.key }}"
changed_when: true
- name: Check whether VS Code CLI is available on workstation host
tags: [packages, vscode]
ansible.builtin.command:
argv:
- code
- --version
become_user: "{{ username }}"
environment:
HOME: "{{ user_home }}"
register: workstation_vscode_cli
changed_when: false
failed_when: false
when: (workstation_host_vscode_extensions | default([])) | length > 0
- name: Ensure VS Code CLI is available before managing extensions
tags: [packages, vscode]
ansible.builtin.fail:
msg: Ensure Visual Studio Code is installed before managing workstation VS Code extensions.
when:
- (workstation_host_vscode_extensions | default([])) | length > 0
- workstation_vscode_cli.rc != 0
- name: Read installed VS Code extensions on workstation host
tags: [packages, vscode]
ansible.builtin.command:
argv:
- code
- --list-extensions
become_user: "{{ username }}"
environment:
HOME: "{{ user_home }}"
register: workstation_vscode_extensions_current
changed_when: false
when:
- (workstation_host_vscode_extensions | default([])) | length > 0
- workstation_vscode_cli.rc == 0
- name: Install VS Code extensions on workstation host
tags: [packages, vscode]
ansible.builtin.command:
argv:
- code
- --install-extension
- "{{ item }}"
- --force
become_user: "{{ username }}"
environment:
HOME: "{{ user_home }}"
loop: "{{ workstation_host_vscode_extensions | default([]) }}"
loop_control:
label: "{{ item }}"
when:
- workstation_vscode_cli.rc == 0
- item not in (workstation_vscode_extensions_current.stdout_lines | default([]))
- name: Download workstation GNOME extension archives
tags: [packages, gnome]
ansible.builtin.get_url:
url: >-
https://extensions.gnome.org/download-extension/{{ item.uuid }}.shell-extension.zip?version_tag={{ item.version_tag }}
dest: "{{ workstation_gnome_extension_dir }}/{{ item.uuid }}.zip"
owner: "{{ username }}"
group: "{{ user_group }}"
mode: "0644"
loop: "{{ workstation_gnome_extensions | default([]) }}"
loop_control:
label: "{{ item.uuid }}"
- name: Check installed workstation GNOME extensions
tags: [packages, gnome]
ansible.builtin.stat:
path: "{{ user_home }}/.local/share/gnome-shell/extensions/{{ item.uuid }}/metadata.json"
loop: "{{ workstation_gnome_extensions | default([]) }}"
loop_control:
label: "{{ item.uuid }}"
register: workstation_gnome_extension_install_state
- name: Install workstation GNOME extensions from downloaded archives
tags: [packages, gnome]
ansible.builtin.command:
cmd: "gnome-extensions install --force {{ workstation_gnome_extension_dir }}/{{ item.uuid }}.zip"
become_user: "{{ username }}"
environment: "{{ workstation_gnome_environment }}"
loop: "{{ workstation_gnome_extensions | default([]) }}"
loop_control:
label: "{{ item.uuid }}"
when: >-
not (
workstation_gnome_extension_install_state.results
| selectattr('item.uuid', 'equalto', item.uuid)
| map(attribute='stat.exists')
| first
| default(false)
)
- name: Read current workstation GNOME enabled extensions
tags: [gnome]
ansible.builtin.command:
cmd: gsettings get org.gnome.shell enabled-extensions
become_user: "{{ username }}"
environment: "{{ workstation_gnome_environment }}"
register: workstation_enabled_gnome_extensions_current
changed_when: false
- name: Compute desired workstation GNOME enabled extensions
tags: [gnome]
ansible.builtin.set_fact:
workstation_enabled_gnome_extensions_current_list: >-
{{
(
workstation_enabled_gnome_extensions_current.stdout
| default('')
| regex_search('\[.*\]')
| default('[]', true)
)
| from_yaml
}}
- name: Build desired workstation GNOME enabled extensions list
tags: [gnome]
ansible.builtin.set_fact:
workstation_enabled_gnome_extensions_desired: >-
{{
(
workstation_enabled_gnome_extensions_current_list
+ (
workstation_gnome_extensions
| default([])
| selectattr('enabled', 'defined')
| selectattr('enabled')
| map(attribute='uuid')
| list
)
)
| difference(workstation_disabled_gnome_extensions | default([]))
| unique
| sort
}}
- name: Build workstation GNOME extensions gsettings payload
tags: [gnome]
ansible.builtin.set_fact:
workstation_enabled_gnome_extensions_desired_gsettings: >-
[{% for extension_uuid in workstation_enabled_gnome_extensions_desired -%}
'{{ extension_uuid | replace("'", "\\'") }}'{% if not loop.last %}, {% endif %}
{%- endfor %}]
- name: Determine whether workstation GNOME enabled extensions must change
tags: [gnome]
ansible.builtin.set_fact:
workstation_gnome_extensions_state_changed: >-
{{ (workstation_enabled_gnome_extensions_current_list | sort) != workstation_enabled_gnome_extensions_desired }}
- name: Apply workstation GNOME enabled extensions list
tags: [gnome]
ansible.builtin.command:
argv:
- gsettings
- set
- org.gnome.shell
- enabled-extensions
- "{{ workstation_enabled_gnome_extensions_desired_gsettings }}"
become_user: "{{ username }}"
environment: "{{ workstation_gnome_environment }}"
changed_when: workstation_gnome_extensions_state_changed
when: workstation_gnome_extensions_state_changed
- name: Enable UFW firewall on workstation
tags: [services, packages]
community.general.ufw:
state: enabled
when: workstation_firewall_backend | default('ufw') == 'ufw'

View File

@@ -78,29 +78,12 @@
- profile_workstation_dev_common
- name: Configure Fedora WSL workstation development layer
hosts: workstation_dev_wsl_fedora
hosts: workstation_dev_wsl
become: true
roles:
- profile_workstation_dev_wsl
- name: Configure native Linux workstation host layer
hosts: workstation_host_linux
become: true
roles:
- profile_workstation_gnome
- name: Configure WSL workstation development layer
hosts: workstation_dev_wsl_ubuntu
become: true
roles:
- packages_ubuntu
- services_systemd
- profile_workstation_dev_common
- profile_workstation_dev_wsl
- name: Configure Ubuntu server
hosts: ubuntu_server
become: true