- name: 'Firefox: Setting base path' tags: - config - firefox block: - name: 'Firefox: Setting path (Linux)' set_fact: firefox_path: '~/.mozilla/firefox' when: ansible_system == 'Linux' - name: 'Firefox: Setting path (Darwin)' set_fact: firefox_path: '~/Library/Application Support/Firefox' when: ansible_system == 'Darwin' - name: 'Firefox: Discovering profile path' tags: - config - firefox block: - name: 'Firefox: Setting profile_path' set_fact: profile_path: "{{ firefox_path }}/{{ lookup('ini', 'Path section=Profile0 file=' + firefox_path + '/profiles.ini') }}" - name: 'Firefox: Setting user config path' set_fact: userconfig_path: "{{ profile_path }}/user.js" - name: 'Firefox: Updating config' tags: - config - firefox block: - name: 'Firefox: Downloading lockdown config (relaxed)' 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: Replacing 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 }}" loop_control: label: "{{ item.name }}"