Automatically install Firefox extensions

This commit is contained in:
2026-11-28 16:18:32 +00:00
parent d20cba3e15
commit bda2cb18c4
9 changed files with 145 additions and 54 deletions

View File

@@ -0,0 +1,28 @@
---
- name: install homebrew package
homebrew_cask:
name: firefox
state: latest
- name: set enterprise policies
set_fact:
firefox_darwin_policies: >-
{{ (lookup('template', 'policies.json.j2') | from_json).policies
| combine({'EnterprisePoliciesEnabled': true}) }}
- name: read current enterprise policies
command: plutil -convert json -o - /Library/Preferences/org.mozilla.firefox.plist
register: firefox_current_policies
changed_when: false
failed_when: false
- name: install enterprise policies
when: >-
firefox_current_policies.rc != 0 or
firefox_current_policies.stdout | from_json != firefox_darwin_policies
become: true
shell: >-
plutil -convert xml1 -o - - |
defaults import /Library/Preferences/org.mozilla.firefox -
args:
stdin: '{{ firefox_darwin_policies | to_json }}'