refactor: manage GNOME extensions with reusable tasks for Pano and Tiling Shell
This commit is contained in:
parent
739cf3c202
commit
8048fc7f9f
@ -1,2 +1,5 @@
|
|||||||
- name: Install Pano - Clipboard Manager
|
- name: Install Pano - Clipboard Manager
|
||||||
ansible.builtin.import_tasks: tasks/workstations/gnome-extensions/pano.yml
|
ansible.builtin.import_tasks: tasks/workstations/gnome-extensions/pano.yml
|
||||||
|
|
||||||
|
- name: Install Tiling Shell - Window Manager
|
||||||
|
ansible.builtin.import_tasks: tasks/workstations/gnome-extensions/tilingshell.yml
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
---
|
||||||
|
- name: Manage GNOME extension
|
||||||
|
vars:
|
||||||
|
requested_git_tag: "{{ git_tag }}"
|
||||||
|
extension_name: "{{ ext_name }}"
|
||||||
|
extension_url: "{{ ext_url }}"
|
||||||
|
extension_path: "{{ ansible_user_dir }}/.local/share/gnome-shell/extensions/{{ ext_id }}"
|
||||||
|
version_file: "{{ extension_path }}/version.txt"
|
||||||
|
block:
|
||||||
|
- name: Check if extension is installed
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ extension_path }}"
|
||||||
|
register: ext_check
|
||||||
|
|
||||||
|
- name: Read last installed version
|
||||||
|
ansible.builtin.slurp:
|
||||||
|
src: "{{ version_file }}"
|
||||||
|
register: installed_version
|
||||||
|
ignore_errors: true
|
||||||
|
when: ext_check.stat.exists
|
||||||
|
|
||||||
|
- name: Determine if update is needed
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
update_needed: >-
|
||||||
|
{{ installed_version.content is not defined or
|
||||||
|
(installed_version.content | b64decode | trim != requested_git_tag) }}
|
||||||
|
|
||||||
|
- name: Delete old extension if updating
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ extension_path }}"
|
||||||
|
state: absent
|
||||||
|
when: update_needed
|
||||||
|
|
||||||
|
- name: Create directory for extension
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ extension_path }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
when: not ext_check.stat.exists or update_needed
|
||||||
|
|
||||||
|
- name: Download extension
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "{{ extension_url | replace('%TAG%', requested_git_tag) }}"
|
||||||
|
dest: "{{ extension_path }}/release.zip"
|
||||||
|
mode: '0644'
|
||||||
|
when: update_needed or not ext_check.stat.exists
|
||||||
|
|
||||||
|
- name: Extract extension
|
||||||
|
ansible.builtin.unarchive:
|
||||||
|
src: "{{ extension_path }}/release.zip"
|
||||||
|
dest: "{{ extension_path }}"
|
||||||
|
when: update_needed or not ext_check.stat.exists
|
||||||
|
|
||||||
|
- name: Store installed version of the extension
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ requested_git_tag }}"
|
||||||
|
dest: "{{ version_file }}"
|
||||||
|
mode: '0644'
|
||||||
|
when: update_needed or not ext_check.stat.exists
|
||||||
|
|
||||||
|
- name: Cleanup post installation
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ extension_path }}/release.zip"
|
||||||
|
state: absent
|
||||||
|
when: not ext_check.stat.exists or update_needed
|
||||||
|
|
||||||
|
- name: Notify user of required GNOME Shell reload
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: >
|
||||||
|
Please reload GNOME Shell by pressing Alt + F2, typing 'r' and pressing Enter.
|
||||||
|
Then enable the {{ extension_name }} in GNOME Tweaks.
|
||||||
|
Or on Wayland, log out and back in.
|
||||||
|
when: not ext_check.stat.exists or update_needed
|
@ -1,40 +1,7 @@
|
|||||||
- name: Check if Pano - Clipboard Manager is installed
|
- name: Manage Pano Clipboard Manager
|
||||||
ansible.builtin.stat:
|
ansible.builtin.include_tasks: tasks/workstations/gnome-extensions/manage_gnome_extension.yml
|
||||||
path: "{{ ansible_user_dir }}/.local/share/gnome-shell/extensions/pano@elhan.io"
|
vars:
|
||||||
register: pano_check
|
git_tag: "v23-alpha3"
|
||||||
|
ext_name: "Pano - Clipboard Manager"
|
||||||
- name: Create Pano - Clipboard Manager directory
|
ext_url: "https://github.com/oae/gnome-shell-pano/releases/download/%TAG%/pano@elhan.io.zip"
|
||||||
ansible.builtin.file:
|
ext_id: "pano@elhan.io"
|
||||||
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
|
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
- name: Manage Tiling Shell - Window Manager
|
||||||
|
ansible.builtin.include_tasks: tasks/workstations/gnome-extensions/manage_gnome_extension.yml
|
||||||
|
vars:
|
||||||
|
git_tag: "16.1"
|
||||||
|
ext_name: "Tiling Shell - Window Manager"
|
||||||
|
ext_url: "https://github.com/domferr/tilingshell/releases/download/%TAG%/tilingshell@ferrarodomenico.com.zip"
|
||||||
|
ext_id: "tilingshell@ferrarodomenico.com"
|
Loading…
x
Reference in New Issue
Block a user