summaryrefslogtreecommitdiffstats
path: root/roles/firefox/tasks/main.yml
blob: 05a5026fa48c4d16d19ab0b8e4817d148c50acb8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
- name: "Include OS-specific variables"
  ansible.builtin.include_vars: "{{ ansible_facts['distribution'] | lower }}.yml"

- name: "Ensure firefox is installed"
  become: true
  ansible.builtin.package:
    name: "{{ firefox_package }}"
    state: "present"

- name: "Install browserpass extension for Firefox"
  ansible.builtin.include_tasks: "install_browserpass.yml"
  when: firefox_install_browserpass | default(false)

# NOTE: passff extension is using sed/curl during install and python/pass to run
# Make sure those dependencies are installed on the target system before enabling this part.
# It doesn't make a lot of sense to have all these dependencies added to the firefox role, just for using
# 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"
  when: firefox_install_passff | default(false)

- name: "Create policies directory"
  become: true
  ansible.builtin.file:
    path: "/etc/firefox/policies"
    state: "directory"
    mode: "0755"

- name: "Set firefox_policies fact"
  ansible.builtin.set_fact:
    firefox_policies: "{{ firefox_default_policies | combine(firefox_policies_override) }}"

- name: "Create Firefox policies file"
  become: true
  ansible.builtin.copy:
    dest: "/etc/firefox/policies/policies.json"
    mode: "0644"
    content: |
      {
        "policies": {{ firefox_policies | tojson(indent=4) }}
      }

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