dotfiles/.ansible/roles/desktop/tasks/firefox.yaml

56 lines
1.5 KiB
YAML

- name: 'Firefox: Set base path'
tags:
- config
- firefox
block:
- set_fact:
firefox_path: '~/.mozilla/firefox'
when: ansible_system == 'Linux'
- set_fact:
firefox_path: '~/Library/Application Support/Firefox'
when: ansible_system == 'Darwin'
- name: 'Firefox: Discover profile path'
tags:
- config
- firefox
block:
- set_fact:
profile_path: "{{ firefox_path }}/{{ lookup('ini', 'Path section=Profile0 file=' + firefox_path + '/profiles.ini') }}"
- set_fact:
userconfig_path: "{{ profile_path }}/user.js"
- name: 'Firefox: Lockdown config (relaxed)'
tags:
- config
- firefox
block:
- name: 'Firefox: Download lockdown (relaxed) config'
get_url:
url: 'https://raw.githubusercontent.com/pyllyukko/user.js/relaxed/user.js'
dest: "{{ userconfig_path }}-lockdown"
mode: '0600'
force: yes
backup: no
- name: 'Firefox: Replace user.js'
copy:
src: "{{ userconfig_path }}-lockdown"
dest: "{{ userconfig_path }}"
mode: '0600'
force: yes
backup: no
- name: 'Firefox: Tweaking config'
tags:
- config
- firefox
block:
- name: 'Firefox: Modifying user.js'
lineinfile:
path: "{{ userconfig_path }}"
state: present
regexp: "{{ item.name | regex_replace('\\.', '\\.') }}"
line: "user_pref(\"{{ item.name }}\", {{ item.value }});"
loop: "{{ firefox_user_prefs }}"