From f09a708fe92b4f8f8c83ff027457f392ba3369bc Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Sun, 8 Nov 2026 22:02:17 +0100 Subject: [PATCH] Add lifecycle flags for AI desktop applications Manage ChatGPT Desktop, OpenCode Desktop, and Cline Desktop with the same install/uninstall lifecycle pattern used by the CLI coding agents: independent flags per app, a shared ai_desktop_apps map, a common pre-task that rejects conflicting install/uninstall pairs, and explicit install and removal task flows. ChatGPT opts in per host through chatgpt_desktop_install_enabled, Cline opts in through the desktop_gnome group vars, and OpenCode Desktop keeps removal selected so the retired opencode RPM and every cached download converge away on graphical hosts. Removal never touches user data, GNOME favorites, or the npm-managed CLI counterparts. --- AGENTS.md | 4 + README.md | 36 ++++++-- .../inventory/group_vars/desktop_gnome.yml | 5 +- ansible/inventory/group_vars/fedora.yml | 36 +++++++- ansible/inventory/host_vars/ikaros.yml | 2 +- ansible/inventory/host_vars/nymph.yml | 2 +- .../packages_fedora/tasks/chatgpt_desktop.yml | 92 +++++++++++++++++++ .../packages_fedora/tasks/cline_desktop.yml | 40 +++++++- ansible/roles/packages_fedora/tasks/main.yml | 73 ++++----------- .../tasks/opencode_desktop.yml | 78 ++++++++++++++++ .../profile_desktop_gnome/tasks/main.yml | 2 +- ansible/site.yml | 13 +++ 12 files changed, 316 insertions(+), 67 deletions(-) create mode 100644 ansible/roles/packages_fedora/tasks/chatgpt_desktop.yml create mode 100644 ansible/roles/packages_fedora/tasks/opencode_desktop.yml diff --git a/AGENTS.md b/AGENTS.md index b8ca056..cd0cd5c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -56,6 +56,7 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora - Focused checks: - Emacs is disabled by default; temporary Emacs check: `ansible-playbook ansible/site.yml --limit --tags emacs --check --diff -e emacs_enabled=true` - AI coding agents: `ansible-playbook ansible/site.yml --limit --tags ai_agents --check --diff` + - AI desktop apps lifecycle: `ansible-playbook ansible/site.yml --limit ikaros --tags chatgpt,opencode_desktop,cline_desktop --check --diff` - Mail bootstrap: `sh -n scripts/bootstrap_mail.sh` and `shellcheck scripts/bootstrap_mail.sh` - Thunderbird iCloud profile: `ansible-playbook ansible/site.yml --limit ikaros --tags thunderbird --check --diff` - Server NPM Quadlet: `systemctl status prometheus-npm.service`; the Compose fallback is retired. @@ -551,6 +552,9 @@ validated exports of older historical data will use a dedicated Atlas NFS datase - `dotfiles_common` deploys `ai_agents_dotfiles` and renders `ai_agents_templates` only when deployment is enabled. - Removal is limited to the managed npm packages and `/usr/local/bin/bob`; never remove agent dotfiles, instructions, credentials, or user data. - Keep `.config/ai/` as the common instruction source; update agent-specific entrypoints to reference it rather than duplicating instruction text. +- Fedora desktop AI apps (`chatgpt_desktop`, `opencode_desktop`, `cline_desktop`) follow the same lifecycle pattern through `ai_desktop_apps` in `ansible/inventory/group_vars/fedora.yml`; `install_enabled` and `uninstall_enabled` are independent per app and mutually exclusive (enforced by the common pre-task). +- ChatGPT opts in per host (`ikaros`, `nymph`); Cline opts in through `desktop_gnome` group vars; OpenCode Desktop keeps removal selected by default because Cline replaced it. +- Desktop-app removal deletes only managed artifacts: the RPM package (`chatgpt`, `opencode`, `cline`), ChatGPT's managed repository and signing key, and every cached download; it never removes user data, GNOME favorites, or the npm-managed CLI counterparts. ## Tooling Notes - Install local tooling with: diff --git a/README.md b/README.md index 683e553..2edb405 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,11 @@ nymph is allowed to break `ikaros` is the stable personal Fedora/GNOME desktop. `nymph` is the laptop and gets the same shared desktop dotfiles while GNOME itself stays close to the Fedora defaults. The legacy `void` and `desktop` groups are compatibility parents; the main axes are `platform_*`, `role_*`, and `desktop_*`. -The official ChatGPT desktop RPM is enabled only on `ikaros` and `nymph`. The -playbook configures OpenAI's signed RPM repository and imports its pinned RPM -signing key before installation; subsequent updates are handled by DNF. +The official ChatGPT desktop RPM is installed only on `ikaros` and `nymph` +through their `chatgpt_desktop_install_enabled` host overrides. The playbook +configures OpenAI's signed RPM repository and imports its pinned RPM signing +key before installation; subsequent updates are handled by DNF. Enabling +`chatgpt_desktop_uninstall_enabled` removes the package, repository, and key. ## Deferred planned node: Cerberus @@ -620,6 +622,26 @@ only in the entry for the agent being removed, then run: ansible-playbook ansible/site.yml --limit deadalus --tags ai_agents --check --diff ``` +### AI desktop applications + +The same lifecycle-flag pattern manages the Fedora desktop applications +through `ai_desktop_apps` in `ansible/inventory/group_vars/fedora.yml`. +`chatgpt_desktop`, `opencode_desktop` and `cline_desktop` each expose +`install_enabled` and `uninstall_enabled`, and the common pre-task rejects +both being true for the same app. ChatGPT opts in per host (`ikaros`, `nymph`), +Cline opts in through `desktop_gnome` group vars, and OpenCode Desktop keeps +removal selected because Cline replaced it. + +Removal deletes only what the playbook manages — the installed RPM package, +ChatGPT's managed repository and signing key, and every cached download — and +leaves GNOME favorites, user data, and the npm-managed CLI counterparts +untouched. To switch an app between installed and removed, flip exactly one +of its lifecycle flags, then preview with: + +```bash +ansible-playbook ansible/site.yml --limit ikaros --tags chatgpt,opencode_desktop,cline_desktop --check --diff +``` + ### Cline Desktop on Fedora The [official Cline Desktop RPM](https://cline.bot/desktop) is managed on the @@ -643,9 +665,11 @@ ansible-playbook ansible/site.yml --limit ikaros --tags cline_desktop -K Run locally on each workstation (`ansible_connection: local`); use `--limit nymph` on the laptop. With a cold RPM cache, check mode reports that dependency resolution is not validated; the real run downloads, verifies, and installs the package. -Once Cline is installed, any previously installed OpenCode Desktop RPM can be -retired once with `sudo rpm -e opencode`. This does not remove the npm CLI or -user data; package removal is not part of ongoing convergence. +Cline replaced OpenCode Desktop: its `ai_desktop_apps` entry keeps +`opencode_desktop_uninstall_enabled: true` by default, so a previously +installed `opencode` RPM converges away on graphical hosts. Flip the entry's +flags to reinstall the pinned release instead. Neither removal touches the +npm CLI or user data. ### Thunderbird iCloud profile on Fedora diff --git a/ansible/inventory/group_vars/desktop_gnome.yml b/ansible/inventory/group_vars/desktop_gnome.yml index 631172e..abd1995 100644 --- a/ansible/inventory/group_vars/desktop_gnome.yml +++ b/ansible/inventory/group_vars/desktop_gnome.yml @@ -4,8 +4,9 @@ desktop_environment: gnome desktop_sessions_enabled: [] desktop_default_session: gnome emacs_enabled: true -cline_desktop_enabled: true -cline_desktop_launcher: Cline.desktop +# Cline Desktop is installed (and pinned in the GNOME favorites) on every +# GNOME host; set cline_desktop_uninstall_enabled here to remove it instead. +cline_desktop_install_enabled: true # Fedora Workstation/GNOME desktop applications. Keep this profile separate from # workstation_* so nymph can remain a desktop laptop rather than a dev workstation. diff --git a/ansible/inventory/group_vars/fedora.yml b/ansible/inventory/group_vars/fedora.yml index 1f305ba..a43ea62 100644 --- a/ansible/inventory/group_vars/fedora.yml +++ b/ansible/inventory/group_vars/fedora.yml @@ -64,6 +64,9 @@ fedora_flatpak_remote_name: flathub fedora_flatpak_remote_url: https://dl.flathub.org/repo/flathub.flatpakrepo cline_desktop_version: "0.0.49" +# Launcher file shipped by the pinned RPM; the GNOME profile pins it in the +# favorites while installation stays enabled. +cline_desktop_launcher: Cline.desktop # Digests published with the official GitHub release; update with the version. cline_desktop_rpm_checksums: x86_64: sha256:e10036a036ee531451695559e2c96feceb3d621408a6615bdd708ffcf9e778ab @@ -72,7 +75,38 @@ cline_desktop_rpm_url: >- https://github.com/cline/cline/releases/download/desktop-v{{ cline_desktop_version }}/Cline_{{ cline_desktop_version }}_{{ ansible_facts['architecture'] }}.rpm cline_desktop_rpm_path: "/var/cache/cline-desktop-{{ cline_desktop_version }}-{{ ansible_facts['architecture'] }}.rpm" -chatgpt_desktop_enabled: false +# OpenCode Desktop was replaced by Cline Desktop. The pinned release stays +# available for reinstall, while removal is selected in the lifecycle flags +# below so leftovers from the switch converge away on graphical hosts. +opencode_desktop_version: "2.2.5" +# Digests published with the official GitHub release; update with the version. +opencode_desktop_rpm_checksums: + x86_64: sha256:4feb27fe98df9b7579abd31a790d331e9aff87c95f67081beefa2aaaa76ebada + aarch64: sha256:e84b1e03e2b4fb337ddfe015b6457a7aa0dfe171338be08e643ad66b1657033a +opencode_desktop_rpm_url: >- + https://github.com/anomalyco/opencode/releases/download/v{{ opencode_desktop_version }}/opencode-desktop-linux-{{ ansible_facts['architecture'] }}.rpm +opencode_desktop_rpm_path: "/var/cache/opencode-desktop-{{ opencode_desktop_version }}-{{ ansible_facts['architecture'] }}.rpm" + +# AI desktop-app lifecycle controls are independent for every app and mirror +# the CLI coding-agent flags. Installation and removal are mutually exclusive +# per app; the common pre-task enforces this before any changes are made. +# ChatGPT opts in per host, Cline opts in through desktop_gnome group vars. +chatgpt_desktop_install_enabled: false +chatgpt_desktop_uninstall_enabled: false +opencode_desktop_install_enabled: false +opencode_desktop_uninstall_enabled: true + +ai_desktop_apps: + chatgpt_desktop: + install_enabled: "{{ chatgpt_desktop_install_enabled }}" + uninstall_enabled: "{{ chatgpt_desktop_uninstall_enabled }}" + opencode_desktop: + install_enabled: "{{ opencode_desktop_install_enabled }}" + uninstall_enabled: "{{ opencode_desktop_uninstall_enabled }}" + cline_desktop: + install_enabled: "{{ cline_desktop_install_enabled | default(false) }}" + uninstall_enabled: "{{ cline_desktop_uninstall_enabled | default(false) }}" + chatgpt_desktop_supported_fedora_versions: - "43" - "44" diff --git a/ansible/inventory/host_vars/ikaros.yml b/ansible/inventory/host_vars/ikaros.yml index 0e796a4..030b175 100644 --- a/ansible/inventory/host_vars/ikaros.yml +++ b/ansible/inventory/host_vars/ikaros.yml @@ -6,7 +6,7 @@ codex_relay_uninstall_enabled: true gemini_cli_install_enabled: false gemini_cli_deploy_enabled: false gemini_cli_uninstall_enabled: true -chatgpt_desktop_enabled: true +chatgpt_desktop_install_enabled: true desktop_ai_media_enabled: true desktop_ai_media_external_storage_enabled: true desktop_ai_media_external_luks_uuid: 6948c504-2d60-4cc8-9e7f-3ccdf28e80d7 diff --git a/ansible/inventory/host_vars/nymph.yml b/ansible/inventory/host_vars/nymph.yml index bef97f3..a19c1fe 100644 --- a/ansible/inventory/host_vars/nymph.yml +++ b/ansible/inventory/host_vars/nymph.yml @@ -7,7 +7,7 @@ gemini_cli_install_enabled: false gemini_cli_deploy_enabled: false gemini_cli_uninstall_enabled: true -chatgpt_desktop_enabled: true +chatgpt_desktop_install_enabled: true # Fedora Workstation/GNOME laptop target. GNOME is provided by the base Fedora # Workstation install; Ansible deploys shared desktop dotfiles but leaves GNOME diff --git a/ansible/roles/packages_fedora/tasks/chatgpt_desktop.yml b/ansible/roles/packages_fedora/tasks/chatgpt_desktop.yml new file mode 100644 index 0000000..0e3680e --- /dev/null +++ b/ansible/roles/packages_fedora/tasks/chatgpt_desktop.yml @@ -0,0 +1,92 @@ +--- +# ChatGPT desktop is installed from OpenAI's signed RPM repository; removal +# must clean up the package, the managed repository and its signing key. +- name: Validate ChatGPT desktop architecture on Fedora + tags: [packages, chatgpt] + ansible.builtin.assert: + that: + - ansible_facts['architecture'] in chatgpt_desktop_supported_architectures + - ansible_facts['distribution_major_version'] in chatgpt_desktop_supported_fedora_versions + fail_msg: >- + ChatGPT desktop supports Fedora {{ chatgpt_desktop_supported_fedora_versions | join(' and ') }} + on x86_64 or aarch64; detected Fedora {{ ansible_facts['distribution_major_version'] }} + on {{ ansible_facts['architecture'] }}. + when: chatgpt_desktop_install_enabled | default(false) | bool + +- name: Install ChatGPT desktop RPM signing key + tags: [packages, chatgpt] + ansible.builtin.copy: + src: "{{ chatgpt_desktop_rpm_gpg_key }}" + dest: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" + owner: root + group: root + mode: "0644" + when: chatgpt_desktop_install_enabled | default(false) | bool + +- name: Import ChatGPT desktop RPM signing key + tags: [packages, chatgpt] + ansible.builtin.rpm_key: + state: present + key: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" + when: chatgpt_desktop_install_enabled | default(false) | bool + +- name: Configure ChatGPT desktop RPM repository + tags: [packages, chatgpt] + ansible.builtin.yum_repository: + name: openai-chatgpt + description: ChatGPT + baseurl: "{{ chatgpt_desktop_rpm_repository }}" + enabled: true + gpgcheck: true + repo_gpgcheck: true + gpgkey: "file:///etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" + state: present + when: chatgpt_desktop_install_enabled | default(false) | bool + +- name: Install ChatGPT desktop on selected Fedora hosts + tags: [packages, chatgpt] + ansible.builtin.dnf: + name: chatgpt + state: latest + update_cache: true + when: chatgpt_desktop_install_enabled | default(false) | bool + +- name: Check for the installed ChatGPT desktop signing key + tags: [packages, chatgpt] + ansible.builtin.stat: + path: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" + get_checksum: false + register: chatgpt_desktop_signing_key + when: chatgpt_desktop_uninstall_enabled | default(false) | bool + +- name: Remove ChatGPT desktop from selected Fedora hosts + tags: [packages, chatgpt] + ansible.builtin.dnf: + name: chatgpt + state: absent + when: chatgpt_desktop_uninstall_enabled | default(false) | bool + +- name: Remove ChatGPT desktop RPM repository + tags: [packages, chatgpt] + ansible.builtin.yum_repository: + name: openai-chatgpt + state: absent + when: chatgpt_desktop_uninstall_enabled | default(false) | bool + +# rpm_key reads the identifier from the key file, so only remove the key from +# the RPM database while the deployed file is still present. +- name: Remove ChatGPT desktop RPM signing key from the RPM database + tags: [packages, chatgpt] + ansible.builtin.rpm_key: + state: absent + key: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" + when: + - chatgpt_desktop_uninstall_enabled | default(false) | bool + - chatgpt_desktop_signing_key.stat.exists | default(false) + +- name: Remove ChatGPT desktop RPM signing key file + tags: [packages, chatgpt] + ansible.builtin.file: + path: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" + state: absent + when: chatgpt_desktop_uninstall_enabled | default(false) | bool diff --git a/ansible/roles/packages_fedora/tasks/cline_desktop.yml b/ansible/roles/packages_fedora/tasks/cline_desktop.yml index 6d9d326..bd8ae99 100644 --- a/ansible/roles/packages_fedora/tasks/cline_desktop.yml +++ b/ansible/roles/packages_fedora/tasks/cline_desktop.yml @@ -1,10 +1,14 @@ --- +# Cline Desktop ships unsigned RPMs from its GitHub releases; only the +# checksum-verified download makes the local installation trustworthy. - name: Validate Cline Desktop architecture on Fedora ansible.builtin.assert: that: - ansible_facts['architecture'] in cline_desktop_rpm_checksums fail_msg: "No verified Cline Desktop RPM for {{ ansible_facts['architecture'] }}." + when: cline_desktop_install_enabled | default(false) | bool +# Runs for both flows so the register below is always valid. - name: Check for cached Cline Desktop RPM ansible.builtin.stat: path: "{{ cline_desktop_rpm_path }}" @@ -20,7 +24,9 @@ group: root mode: "0644" # get_url only sends HEAD in check mode and cannot populate a cold cache. - when: not ansible_check_mode + when: + - cline_desktop_install_enabled | default(false) | bool + - not ansible_check_mode - name: Install Cline Desktop on Fedora ansible.builtin.dnf: @@ -29,7 +35,10 @@ # Upstream ships an unsigned RPM. The download above verifies its pinned # SHA-256; do not disable signature checks in system repository settings. disable_gpg_check: true - when: not ansible_check_mode or cline_desktop_rpm_cache.stat.exists + when: + - cline_desktop_install_enabled | default(false) | bool + - not ansible_check_mode + or cline_desktop_rpm_cache.stat.exists - name: Explain Cline Desktop cold-cache check-mode limitation ansible.builtin.debug: @@ -38,5 +47,32 @@ {{ cline_desktop_version }} before ensuring it is installed. The RPM is not cached, so this dry run cannot validate DNF dependencies. when: + - cline_desktop_install_enabled | default(false) | bool - ansible_check_mode - not cline_desktop_rpm_cache.stat.exists + +# The `cline` RPM package name is verified from the pinned release header; +# removal never touches the npm-managed cline CLI or user data. +- name: Remove Cline Desktop from Fedora + ansible.builtin.dnf: + name: cline + state: absent + when: cline_desktop_uninstall_enabled | default(false) | bool + +# Clean every cached download so retirement also removes outdated pins. +- name: Find cached Cline Desktop RPM downloads + ansible.builtin.find: + paths: /var/cache + patterns: "cline-desktop-*.rpm" + file_type: file + register: cline_desktop_cached_rpms + when: cline_desktop_uninstall_enabled | default(false) | bool + +- name: Remove cached Cline Desktop RPM downloads + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + loop: "{{ cline_desktop_cached_rpms.files | default([]) }}" + loop_control: + label: "{{ item.path }}" + when: cline_desktop_uninstall_enabled | default(false) | bool diff --git a/ansible/roles/packages_fedora/tasks/main.yml b/ansible/roles/packages_fedora/tasks/main.yml index ab2e422..065d030 100644 --- a/ansible/roles/packages_fedora/tasks/main.yml +++ b/ansible/roles/packages_fedora/tasks/main.yml @@ -168,62 +168,29 @@ loop_control: label: "{{ item.key }}" -- name: Manage Cline Desktop on Fedora GNOME workstations +- name: Manage ChatGPT desktop lifecycle on Fedora graphical hosts + tags: [packages, chatgpt] + ansible.builtin.import_tasks: chatgpt_desktop.yml + when: + - "'graphical_desktop' in group_names" + - chatgpt_desktop_install_enabled | default(false) | bool + or chatgpt_desktop_uninstall_enabled | default(false) | bool + +- name: Manage OpenCode Desktop lifecycle on Fedora graphical hosts + tags: [packages, opencode_desktop] + ansible.builtin.import_tasks: opencode_desktop.yml + when: + - "'graphical_desktop' in group_names" + - opencode_desktop_install_enabled | default(false) | bool + or opencode_desktop_uninstall_enabled | default(false) | bool + +- name: Manage Cline Desktop lifecycle on Fedora graphical hosts tags: [packages, cline_desktop] ansible.builtin.import_tasks: cline_desktop.yml when: - - "'desktop_gnome' in group_names" - - cline_desktop_enabled | default(false) | bool - -- name: Validate ChatGPT desktop architecture on Fedora - tags: [packages, chatgpt] - ansible.builtin.assert: - that: - - ansible_facts['architecture'] in chatgpt_desktop_supported_architectures - - ansible_facts['distribution_major_version'] in chatgpt_desktop_supported_fedora_versions - fail_msg: >- - ChatGPT desktop supports Fedora {{ chatgpt_desktop_supported_fedora_versions | join(' and ') }} - on x86_64 or aarch64; detected Fedora {{ ansible_facts['distribution_major_version'] }} - on {{ ansible_facts['architecture'] }}. - when: chatgpt_desktop_enabled | bool - -- name: Install ChatGPT desktop RPM signing key - tags: [packages, chatgpt] - ansible.builtin.copy: - src: "{{ chatgpt_desktop_rpm_gpg_key }}" - dest: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" - owner: root - group: root - mode: "0644" - when: chatgpt_desktop_enabled | bool - -- name: Import ChatGPT desktop RPM signing key - tags: [packages, chatgpt] - ansible.builtin.rpm_key: - state: present - key: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" - when: chatgpt_desktop_enabled | bool - -- name: Configure ChatGPT desktop RPM repository - tags: [packages, chatgpt] - ansible.builtin.yum_repository: - name: openai-chatgpt - description: ChatGPT - baseurl: "{{ chatgpt_desktop_rpm_repository }}" - enabled: true - gpgcheck: true - repo_gpgcheck: true - gpgkey: "file:///etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}" - state: present - when: chatgpt_desktop_enabled | bool - -- name: Install ChatGPT desktop on selected Fedora hosts - tags: [packages, chatgpt] - ansible.builtin.dnf: - name: chatgpt - state: latest - update_cache: true - when: chatgpt_desktop_enabled | bool + - "'graphical_desktop' in group_names" + - cline_desktop_install_enabled | default(false) | bool + or cline_desktop_uninstall_enabled | default(false) | bool - name: Define Fedora Flatpak applications tags: [packages] diff --git a/ansible/roles/packages_fedora/tasks/opencode_desktop.yml b/ansible/roles/packages_fedora/tasks/opencode_desktop.yml new file mode 100644 index 0000000..c89d57a --- /dev/null +++ b/ansible/roles/packages_fedora/tasks/opencode_desktop.yml @@ -0,0 +1,78 @@ +--- +# OpenCode Desktop ships unsigned RPMs from its GitHub releases; only the +# checksum-verified download makes the local installation trustworthy. +- name: Validate OpenCode Desktop architecture on Fedora + ansible.builtin.assert: + that: + - ansible_facts['architecture'] in opencode_desktop_rpm_checksums + fail_msg: "No verified OpenCode Desktop RPM for {{ ansible_facts['architecture'] }}." + when: opencode_desktop_install_enabled | default(false) | bool + +# Runs for both flows so the register below is always valid. +- name: Check for cached OpenCode Desktop RPM + ansible.builtin.stat: + path: "{{ opencode_desktop_rpm_path }}" + get_checksum: false + register: opencode_desktop_rpm_cache + +- name: Download verified OpenCode Desktop RPM + ansible.builtin.get_url: + url: "{{ opencode_desktop_rpm_url }}" + dest: "{{ opencode_desktop_rpm_path }}" + checksum: "{{ opencode_desktop_rpm_checksums[ansible_facts['architecture']] }}" + owner: root + group: root + mode: "0644" + # get_url only sends HEAD in check mode and cannot populate a cold cache. + when: + - opencode_desktop_install_enabled | default(false) | bool + - not ansible_check_mode + +- name: Install OpenCode Desktop on Fedora + ansible.builtin.dnf: + name: "{{ opencode_desktop_rpm_path }}" + state: present + # Upstream ships an unsigned RPM. The download above verifies its pinned + # SHA-256; do not disable signature checks in system repository settings. + disable_gpg_check: true + when: + - opencode_desktop_install_enabled | default(false) | bool + - not ansible_check_mode + or opencode_desktop_rpm_cache.stat.exists + +- name: Explain OpenCode Desktop cold-cache check-mode limitation + ansible.builtin.debug: + msg: >- + A real run will download and SHA-256 verify OpenCode Desktop + {{ opencode_desktop_version }} before ensuring it is installed. + The RPM is not cached, so this dry run cannot validate DNF dependencies. + when: + - opencode_desktop_install_enabled | default(false) | bool + - ansible_check_mode + - not opencode_desktop_rpm_cache.stat.exists + +# The `opencode` RPM package name is verified from the pinned release header; +# removal never touches the npm-managed opencode-ai CLI or user data. +- name: Remove OpenCode Desktop from Fedora + ansible.builtin.dnf: + name: opencode + state: absent + when: opencode_desktop_uninstall_enabled | default(false) | bool + +# Clean every cached download so retirement also removes outdated pins. +- name: Find cached OpenCode Desktop RPM downloads + ansible.builtin.find: + paths: /var/cache + patterns: "opencode-desktop-*.rpm" + file_type: file + register: opencode_desktop_cached_rpms + when: opencode_desktop_uninstall_enabled | default(false) | bool + +- name: Remove cached OpenCode Desktop RPM downloads + ansible.builtin.file: + path: "{{ item.path }}" + state: absent + loop: "{{ opencode_desktop_cached_rpms.files | default([]) }}" + loop_control: + label: "{{ item.path }}" + when: opencode_desktop_uninstall_enabled | default(false) | bool diff --git a/ansible/roles/profile_desktop_gnome/tasks/main.yml b/ansible/roles/profile_desktop_gnome/tasks/main.yml index 6d5b4d1..37fbb4e 100644 --- a/ansible/roles/profile_desktop_gnome/tasks/main.yml +++ b/ansible/roles/profile_desktop_gnome/tasks/main.yml @@ -292,4 +292,4 @@ - name: Pin Cline Desktop in GNOME tags: [cline_desktop] ansible.builtin.import_tasks: cline_desktop.yml - when: cline_desktop_enabled | default(false) | bool + when: cline_desktop_install_enabled | default(false) | bool diff --git a/ansible/site.yml b/ansible/site.yml index 89da00c..7e99ddf 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -33,6 +33,19 @@ loop_control: label: "{{ item.key }}" + - name: Reject conflicting AI desktop-app lifecycle flags + tags: [always, ai_desktop_apps] + ansible.builtin.assert: + that: + - not (item.value.install_enabled | default(false) + and item.value.uninstall_enabled | default(false) | bool) + fail_msg: >- + {{ item.key }} has both install_enabled and uninstall_enabled set to true. + Choose either installation or removal before running the playbook. + loop: "{{ ai_desktop_apps | default({}) | dict2items }}" + loop_control: + label: "{{ item.key }}" + roles: - role: dotfiles_common when: