- name: Firefox (home page and bookmarks of the contest) hosts: all become: yes vars: contest_url: https://atlantic-canada26.kattis.com contest_id: atlantic-canada26 policies: /usr/lib/firefox/distribution/policies.json # The bookmarks of the ICPC image point to http://contest, which is the # contest server of the World Finals. They are replaced by the Kattis pages. bookmarks: - { Placement: toolbar, Title: "Contest", URL: "{{ contest_url }}/contests/{{ contest_id }}" } - { Placement: toolbar, Title: "Problems", URL: "{{ contest_url }}/contests/{{ contest_id }}/problems" } - { Placement: toolbar, Title: "Standings", URL: "{{ contest_url }}/contests/{{ contest_id }}/standings" } - { Placement: toolbar, Title: "Contest Help (offline)", URL: "file:///usr/share/doc/acpc/help/index.html" } - { Placement: toolbar, Title: "Language Documentation", URL: "https://devdocs/" } - { Placement: toolbar, Title: "Technical Notes", URL: "file:///usr/share/doc/icpc/TechNotes.pdf" } tasks: - name: Set the home page and the bookmarks shell: | python3 - "{{ policies }}" <<'PY' import json, sys path = sys.argv[1] data = json.load(open(path)) p = data.setdefault("policies", {}) before = json.dumps(data, sort_keys=True) p["Bookmarks"] = json.loads('{{ bookmarks | to_json }}') p["Homepage"] = {"Locked": True, "StartPage": "homepage-locked", "URL": "{{ contest_url }}"} # No extensions can be installed, and about:config is closed p["ExtensionSettings"] = {"*": {"installation_mode": "blocked"}} p["BlockAboutConfig"] = True if json.dumps(data, sort_keys=True) != before: json.dump(data, open(path, "w"), indent=2) print("changed") PY register: ff changed_when: "'changed' in ff.stdout"