diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-02-22 03:04:59 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-02-22 03:04:59 +0100 |
| commit | 7b8b6a2af4adeba5b2005e449195c1f4e8a136c6 (patch) | |
| tree | 3b98b43f73ff504c7a9118b2ba12ef20fd617016 /roles/firefox/tasks | |
| parent | 8cc2cc696ec426c385f6955436ab3fa92d72acc7 (diff) | |
Refactor firefox role to use flatpak on debian
Diffstat (limited to 'roles/firefox/tasks')
| -rw-r--r-- | roles/firefox/tasks/install-archlinux.yml | 12 | ||||
| -rw-r--r-- | roles/firefox/tasks/install-debian.yml | 20 | ||||
| -rw-r--r-- | roles/firefox/tasks/install-plugin-browserpass.yml (renamed from roles/firefox/tasks/install_browserpass.yml) | 0 | ||||
| -rw-r--r-- | roles/firefox/tasks/install-plugin-passff.yml (renamed from roles/firefox/tasks/install_passff.yml) | 0 | ||||
| -rw-r--r-- | roles/firefox/tasks/main.yml | 21 |
5 files changed, 37 insertions, 16 deletions
diff --git a/roles/firefox/tasks/install-archlinux.yml b/roles/firefox/tasks/install-archlinux.yml new file mode 100644 index 00000000..69a17e4d --- /dev/null +++ b/roles/firefox/tasks/install-archlinux.yml @@ -0,0 +1,12 @@ +--- +- name: "Ensure firefox is installed" + become: true + ansible.builtin.package: + name: "firefox" + state: "present" + +- name: "Set firefox as default" + ansible.builtin.command: + cmd: "xdg-settings set default-web-browser firefox.desktop" + changed_when: false + when: firefox_is_default | default(false) diff --git a/roles/firefox/tasks/install-debian.yml b/roles/firefox/tasks/install-debian.yml new file mode 100644 index 00000000..08cf8950 --- /dev/null +++ b/roles/firefox/tasks/install-debian.yml @@ -0,0 +1,20 @@ +--- +- name: "Ensure firefox is installed via flatpak" + community.general.flatpak: + name: "org.mozilla.firefox" + remote: "flathub" + state: "present" + method: "user" + +- name: "Allow Flatpak Firefox to read system policies" + ansible.builtin.command: + cmd: "flatpak override --user --filesystem=/etc/firefox:ro org.mozilla.firefox" + changed_when: false + +- name: "Set firefox as default" + ansible.builtin.command: + cmd: "xdg-settings set default-web-browser org.mozilla.firefox.desktop" + environment: + XDG_DATA_DIRS: "{{ ansible_facts['env']['HOME'] }}/.local/share/flatpak/exports/share" + changed_when: false + when: firefox_is_default | default(false) diff --git a/roles/firefox/tasks/install_browserpass.yml b/roles/firefox/tasks/install-plugin-browserpass.yml index 50d6cef2..50d6cef2 100644 --- a/roles/firefox/tasks/install_browserpass.yml +++ b/roles/firefox/tasks/install-plugin-browserpass.yml diff --git a/roles/firefox/tasks/install_passff.yml b/roles/firefox/tasks/install-plugin-passff.yml index 00bb76eb..00bb76eb 100644 --- a/roles/firefox/tasks/install_passff.yml +++ b/roles/firefox/tasks/install-plugin-passff.yml diff --git a/roles/firefox/tasks/main.yml b/roles/firefox/tasks/main.yml index c78af295..02aa2243 100644 --- a/roles/firefox/tasks/main.yml +++ b/roles/firefox/tasks/main.yml @@ -1,15 +1,12 @@ --- - name: "Include OS-specific variables" - ansible.builtin.include_vars: "{{ ansible_facts['distribution'] | lower }}.yml" + ansible.builtin.include_vars: "{{ ansible_facts['os_family'] | lower }}.yml" -- name: "Ensure firefox is installed" - become: true - ansible.builtin.package: - name: "{{ firefox_package }}" - state: "present" +- name: "Include OS-specific tasks" + ansible.builtin.include_tasks: "install-{{ ansible_facts['os_family'] | lower }}.yml" - name: "Install browserpass extension for Firefox" - ansible.builtin.include_tasks: "install_browserpass.yml" + ansible.builtin.include_tasks: "install-plugin-browserpass.yml" when: firefox_install_browserpass | default(false) # NOTE: passff extension is using sed/curl during install and python/pass to run @@ -18,7 +15,7 @@ # this extension, which isn't enabled by default. # Personally I find it has better UI/UX than browserpass, but browserpass is more lightweight. - name: "Install passff extension for Firefox" - ansible.builtin.include_tasks: "install_passff.yml" + ansible.builtin.include_tasks: "install-plugin-passff.yml" when: firefox_install_passff | default(false) - name: "Create policies directory" @@ -41,11 +38,3 @@ { "policies": {{ firefox_policies | tojson(indent=4) }} } - -- name: "Set firefox as default" - ansible.builtin.command: - cmd: "xdg-settings set default-web-browser {{ firefox_desktop_file }}" - environment: - XDG_DATA_DIRS: "/var/lib/snapd/desktop:{{ ansible_facts['env']['XDG_DATA_DIRS'] }}" - changed_when: false - when: firefox_is_default | default(false) |
