Make GNOME extension installation idempotent

This commit is contained in:
Fabio Scotto di Santolo
2026-03-25 00:02:57 +01:00
parent e88737b819
commit 167f366560

View File

@@ -153,6 +153,15 @@
loop_control: loop_control:
label: "{{ item.uuid }}" 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 - name: Install workstation GNOME extensions from downloaded archives
tags: [packages, gnome] tags: [packages, gnome]
ansible.builtin.command: ansible.builtin.command:
@@ -162,6 +171,14 @@
loop: "{{ workstation_gnome_extensions | default([]) }}" loop: "{{ workstation_gnome_extensions | default([]) }}"
loop_control: loop_control:
label: "{{ item.uuid }}" 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 - name: Read current workstation GNOME enabled extensions
tags: [gnome] tags: [gnome]