--- - set_fact: ff_dir: "{{ user_home }}/.mozilla/firefox" - name: create ff profiles directory file: path: "{{ ff_dir }}" state: directory - name: create profiles.ini template: src: files/firefox/profiles.ini.jinja2 dest: "{{ ff_dir }}/profiles.ini" # NOTE: ideally we could complete these tasks in a 'with_items' grouped block, # but ansible doesn't allow with_items on blocks... - name: create profile directories file: path: "{{ ff_dir }}/{{ item.name }}" state: directory with_items: "{{ firefox_profiles }}" - name: clone the userprefs repo git: repo: https://github.com/arkenfox/user.js/ dest: /tmp/user.js - name: copy user.js files to each profile copy: src: "/tmp/user.js/{{ item.1.name }}" dest: "{{ ff_dir }}/{{ item.0.name }}/{{ item.1.name }}" mode: "{{ item.1.mode }}" with_nested: - "{{ firefox_profiles }}" - [ { name: user.js, mode: '0644' }, { name: prefsCleaner.sh, mode: '0755' }, { name: updater.sh, mode: '0755' } ] - name: copy user.js overrides to each profile copy: src: files/firefox/user-overrides.js dest: "{{ ff_dir }}/{{ item.name }}/" with_items: "{{ firefox_profiles }}" - name: run the user.js override updater script for each profile shell: chdir: "{{ ff_dir }}/{{ item.name }}" cmd: "{{ ff_dir }}/{{ item.name }}/updater.sh -s" with_items: "{{ firefox_profiles }}" # NOTE: apparently, there's no good way to automate the installation of # extensions anymore: https://blog.mozilla.org/addons/2020/03/10/support-for-extension-sideloading-has-ended/ # we need to look at the post-insall extensions.json, and create it manually # TODO: find out how to copy the settings for 'customised' toolbars # TODO: still resets the default search engine to google... #- name: copy default profile contents # copy: # src: data/firefox_default_profile/ # dest: "{{ ff_dir }}/{{ item.name }}" # with_items: "{{ firefox_profiles }}" # when: item.name == 'ffprofile' # TODO: copy extensions for shopping/banking profiles