marcomc.macos_macprefs
ansible-role-macos-macprefs
An Ansible role to install the 'macprefs' tool on macOS using Homebrew.
If MacPrefs is not already installed on your system, it will be installed via Homebrew.
This role is used in Splinter, a specialized provisioning tool for macOS.
Requirements & Dependencies
- Jeff Geerling's geerlingguy.homebrew, which is specified as an Ansible Galaxy dependency.
Ansible
It has been tested with the following version:
- 2.9
Operating Systems
Targeting macOS 10.15, and possibly earlier versions (not yet tested).
Example Playbook
Just include this role in your list. For example:
- host: all
vars:
macprefs_regular_backup: 720 # every 12 hours
macprefs_backup_dir: ~/Library/Mobile Documents/com~apple~CloudDocs/Macprefs # using iCloud instead of Dropbox
roles:
- marcomc.macos_macprefs
Variables
verbose: no
target_user_id: "{{ ansible_user_id }}"
target_user_default_shell: ''
macprefs_update_for_all_shell_types: no
macprefs_backup_dir: "~/Dropbox/MacPrefsBackup"
macprefs_regular_backup: 0
macprefs_log: '~/Library/Logs/macprefs.log'
By default, MacPrefs looks for its backup folder in your Dropbox directory, assuming Dropbox is already set up on your system.
I personally prefer using iCloud for MacPrefs backups, especially when restoring configuration on a new machine where you are already signed into iCloud as part of the setup process.
Setting Up Periodic Backup with Cron
Grant Full Disk Access to cron
(manual process):
Go to
System Preferences -> Security & Privacy -> Privacy -> Full Disk Access
- Authenticate to unlock the list of allowed applications.
Open the Finder to locate the
cron
binary:open /usr/sbin/
Drag and drop the
cron
binary file into theFull Disk Access
list.
Continuous Integration
This role currently has a basic Travis test (for GitHub) only.
Troubleshooting & Known Issues
License
Copyright
Marco Massari Calderone (c) 2020 - marco@marcomc.com
An Ansible role to install and run 'macprefs' tool on macOS. Also used in Splinter provisioning tool.
ansible-galaxy install marcomc.macos_macprefs