jmri: replace TigerVNC with Xpra for JMRI GUI display

VNC had window management issues and some dialogs wouldn't open correctly.
Xpra runs in rootless mode — each JMRI window appears natively on the
client without a VNC client or XQuartz required.

Changes:
- Remove tigervnc-standalone-server, jmri-vnc.service, .vnc/ directory
- Install xpra, deploy jmri-xpra.service.j2 (systemd unit)
- Update jmri-gui wrapper: DISPLAY=:100, attach instructions printed on launch
- Update defaults: drop VNC vars, add jmri_xpra_display=100
- Rename handler: Restart jmri-vnc -> Restart jmri-xpra

Connect from macOS/Linux:
  xpra attach ssh://jmri@main-street-station/100
This commit is contained in:
Hermes Agent service account
2026-08-01 20:14:49 -05:00
parent 4cb87a57ad
commit 62e9f13a45
6 changed files with 91 additions and 93 deletions

View File

@@ -272,51 +272,55 @@
notify: Restart sshd
# ---------------------------------------------------------------------------
# Phase 4 — VNC server (TigerVNC)
# Persistent virtual display on :1 (port 5901). Replaces X11 forwarding.
# Phase 4 — Xpra virtual display
# Replaces TigerVNC. Rootless mode: each JMRI window appears as a native
# window on the client. Sessions are persistent across disconnects.
# Connect: xpra attach ssh://jmri@main-street-station/{{ jmri_xpra_display }}
# ---------------------------------------------------------------------------
- name: Install TigerVNC server
- name: Remove TigerVNC (replaced by Xpra)
ansible.builtin.apt:
name: tigervnc-standalone-server
state: absent
notify: Reload systemd
- name: Disable and stop jmri-vnc service if present
ansible.builtin.systemd:
name: jmri-vnc
enabled: false
state: stopped
failed_when: false
- name: Remove jmri-vnc systemd unit if present
ansible.builtin.file:
path: /etc/systemd/system/jmri-vnc.service
state: absent
notify: Reload systemd
- name: Remove jmri VNC password directory if present
ansible.builtin.file:
path: "{{ jmri_home }}/.vnc"
state: absent
- name: Install Xpra
ansible.builtin.apt:
name: xpra
state: present
update_cache: false
- name: Create .vnc directory for jmri user
ansible.builtin.file:
path: "{{ jmri_home }}/.vnc"
state: directory
owner: "{{ jmri_user }}"
group: "{{ jmri_group }}"
mode: '0700'
- name: Set VNC password for jmri user
ansible.builtin.shell:
cmd: "printf '{{ jmri_vnc_password }}' | vncpasswd -f > {{ jmri_home }}/.vnc/passwd"
become_user: "{{ jmri_user }}"
no_log: true
changed_when: true
- name: Set correct permissions on VNC password file
ansible.builtin.file:
path: "{{ jmri_home }}/.vnc/passwd"
owner: "{{ jmri_user }}"
group: "{{ jmri_group }}"
mode: '0600'
- name: Deploy jmri-vnc systemd unit
- name: Deploy jmri-xpra systemd unit
ansible.builtin.template:
src: jmri-vnc.service.j2
dest: /etc/systemd/system/jmri-vnc.service
src: jmri-xpra.service.j2
dest: /etc/systemd/system/jmri-xpra.service
owner: root
group: root
mode: '0644'
notify:
- Reload systemd
- Restart jmri-vnc
- Restart jmri-xpra
- name: Enable and start jmri-vnc service
- name: Enable and start jmri-xpra service
ansible.builtin.systemd:
name: jmri-vnc
name: jmri-xpra
enabled: true
state: started
daemon_reload: true