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.
This commit is contained in:
2026-11-08 22:02:17 +01:00
parent ccb4a0daa6
commit f09a708fe9
12 changed files with 316 additions and 67 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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]

View File

@@ -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