mirror of
https://github.com/fscotto/infra.git
synced 2026-11-26 13:49:52 +00:00
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.
79 lines
2.9 KiB
YAML
79 lines
2.9 KiB
YAML
---
|
|
# 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 }}"
|
|
get_checksum: false
|
|
register: cline_desktop_rpm_cache
|
|
|
|
- name: Download verified Cline Desktop RPM
|
|
ansible.builtin.get_url:
|
|
url: "{{ cline_desktop_rpm_url }}"
|
|
dest: "{{ cline_desktop_rpm_path }}"
|
|
checksum: "{{ cline_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:
|
|
- cline_desktop_install_enabled | default(false) | bool
|
|
- not ansible_check_mode
|
|
|
|
- name: Install Cline Desktop on Fedora
|
|
ansible.builtin.dnf:
|
|
name: "{{ cline_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:
|
|
- 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:
|
|
msg: >-
|
|
A real run will download and SHA-256 verify Cline Desktop
|
|
{{ 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
|