- name: Ensure marker directory exists ansible.builtin.file: path: /run/tuxflotte/agent/applied state: directory mode: "0755" - name: Ensure flathub remote is configured community.general.flatpak_remote: name: flathub flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo state: present method: system when: tuxflotte_state == "present" - name: Install Brave via Flatpak community.general.flatpak: name: com.brave.Browser remote: flathub state: present method: system when: tuxflotte_state == "present" # Systemweiter Default (nicht pro Benutzer), da ansible-pull als root ohne # Sitzungskontext läuft. /etc/xdg/mimeapps.list gilt für jeden Benutzer ohne # eigene ~/.config/mimeapps.list. Jeder Lauf erzwingt deterministisch einen # der beiden Werte - kein Tracking, ob ein Admin manuell etwas anderes # gesetzt hat (bekannte Einschränkung, siehe README). - name: Set Brave as system default browser (standardbrowser-Option aktiv) community.general.ini_file: path: /etc/xdg/mimeapps.list section: Default Applications option: "{{ item }}" value: com.brave.Browser.desktop mode: "0644" no_extra_spaces: true loop: - text/html - x-scheme-handler/http - x-scheme-handler/https when: tuxflotte_state == "present" and (tuxflotte_optionen.standardbrowser | default(false)) # Nur zurücksetzen, wenn Brave aktuell tatsächlich als Default eingetragen # ist - sonst würde jeder Lauf auf jedem Gerät ohne Brave-Auswahl einen # eventuell fremd (manuell) gesetzten Standardbrowser überschreiben. - name: Check whether Brave is currently the configured default browser ansible.builtin.command: cmd: grep -q com.brave.Browser.desktop /etc/xdg/mimeapps.list register: tuxflotte_brave_is_default changed_when: false failed_when: false when: tuxflotte_state == "absent" or not (tuxflotte_optionen.standardbrowser | default(false)) - name: Reset default browser to Firefox (standardbrowser-Option inaktiv oder Auftrag abgewählt) community.general.ini_file: path: /etc/xdg/mimeapps.list section: Default Applications option: "{{ item }}" value: firefox.desktop mode: "0644" no_extra_spaces: true loop: - text/html - x-scheme-handler/http - x-scheme-handler/https when: > (tuxflotte_state == "absent" or not (tuxflotte_optionen.standardbrowser | default(false))) and tuxflotte_brave_is_default.rc is defined and tuxflotte_brave_is_default.rc == 0 - name: Record that the brave role ran ansible.builtin.copy: dest: /run/tuxflotte/agent/applied/brave.marker content: "{{ ansible_date_time.iso8601 }}\n" mode: "0644" when: tuxflotte_state == "present" - name: Remove Brave Flatpak (Auftrag abgewählt) community.general.flatpak: name: com.brave.Browser state: absent method: system when: tuxflotte_state == "absent" - name: Remove brave marker (Auftrag abgewählt) ansible.builtin.file: path: /run/tuxflotte/agent/applied/brave.marker state: absent when: tuxflotte_state == "absent"