Simplify the configuration of Firefox

This commit is contained in:
Scott Wallace 2019-01-31 20:37:19 +00:00
parent eb59de6d52
commit 3f0d96167d
3 changed files with 24 additions and 12 deletions

View file

@ -4,3 +4,4 @@
- role: desktop - role: desktop
vars_files: vars_files:
- "roles/desktop/vars/{{ ansible_system|lower }}.yaml" - "roles/desktop/vars/{{ ansible_system|lower }}.yaml"
- "roles/desktop/vars/firefox.yaml"

View file

@ -14,8 +14,11 @@
tags: tags:
- config - config
- firefox - firefox
set_fact: block:
- set_fact:
profile_path: "{{ firefox_path }}/{{ lookup('ini', 'Path section=Profile0 file=' + firefox_path + '/profiles.ini') }}" 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)' - name: 'Firefox: Lockdown config (relaxed)'
tags: tags:
@ -25,27 +28,28 @@
- name: 'Firefox: Download lockdown (relaxed) config' - name: 'Firefox: Download lockdown (relaxed) config'
get_url: get_url:
url: 'https://raw.githubusercontent.com/pyllyukko/user.js/relaxed/user.js' url: 'https://raw.githubusercontent.com/pyllyukko/user.js/relaxed/user.js'
dest: "{{ profile_path }}/user.js-lockdown" dest: "{{ userconfig_path }}-lockdown"
mode: '0600' mode: '0600'
force: yes force: yes
backup: yes backup: no
- name: 'Firefox: Replace user.js' - name: 'Firefox: Replace user.js'
copy: copy:
src: "{{ profile_path }}/user.js-lockdown" src: "{{ userconfig_path }}-lockdown"
dest: "{{ profile_path }}/user.js" dest: "{{ userconfig_path }}"
mode: '0600' mode: '0600'
force: yes force: yes
backup: yes backup: no
- name: 'Firefox: Relaxing further' - name: 'Firefox: Tweaking config'
tags: tags:
- config - config
- firefox - firefox
block: block:
- name: 'Firefox: Allow searching from URL bar' - name: 'Firefox: Modifying user.js'
lineinfile: lineinfile:
path: "{{ profile_path }}/user.js" path: "{{ userconfig_path }}"
state: present state: present
regexp: 'keyword\.enabled' regexp: "{{ item.name | regex_replace('\\.', '\\.') }}"
line: 'user_pref("keyword.enabled", true);' line: "user_pref(\"{{ item.name }}\", {{ item.value }});"
loop: "{{ firefox_user_prefs }}"

View file

@ -0,0 +1,7 @@
firefox_user_prefs:
- name: 'keyword.enabled'
value: "true"
- name: 'network.cookie.thirdparty.sessionOnly'
value: "false"
- name: 'privacy.sanitize.pending'
value: '"[{\"id\":\"shutdown\",\"itemsToClear\":[\"cache\",\"offlineApps\",\"history\",\"formdata\"],\"options\":{}},{\"id\":\"newtab-container\",\"itemsToClear\":[],\"options\":{}}]"'