ansible / ansible.builtin / v2.9.27 / module / osx_defaults Manage macOS user defaults | "added in version" 2.0 of ansible.builtin" Authors: Franck Nijhof (@frenck) stableinterface | supported by communityansible.builtin.osx_defaults (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
osx_defaults allows users to read, write, and delete macOS user defaults from Ansible scripts.
macOS applications and other programs use the defaults system to record user preferences and other information that must be maintained when the applications are not running (such as default font for new documents, or the position of an Info panel).
- osx_defaults: domain: com.apple.Safari key: IncludeInternalDebugMenu type: bool value: true state: present
- osx_defaults: domain: NSGlobalDomain key: AppleMeasurementUnits type: string value: Centimeters state: present
- osx_defaults: domain: /Library/Preferences/com.apple.SoftwareUpdate key: AutomaticCheckEnabled type: int value: 1 become: yes
- osx_defaults: domain: com.apple.screensaver host: currentHost key: showClock type: int value: 1
- osx_defaults: key: AppleMeasurementUnits type: string value: Centimeters
- osx_defaults: key: AppleLanguages type: array value: - en - nl
- osx_defaults: domain: com.geekchimp.macable key: ExampleKeyToRemove state: absent
key: description: - The key of the user preference. required: true type: str host: description: - The host on which the preference should apply. - The special value C(currentHost) corresponds to the C(-currentHost) switch of the defaults commandline tool. type: str version_added: '2.1' version_added_collection: ansible.builtin path: default: /usr/bin:/usr/local/bin description: - The path in which to search for C(defaults). type: str type: choices: - array - bool - boolean - date - float - int - integer - string default: string description: - The type of value to write. type: str state: choices: - absent - list - present default: present description: - The state of the user defaults. - If set to C(list) will query the given parameter specified by C(key). Returns 'null' is nothing found or mis-spelled. - C(list) added in version 2.8. type: str value: description: - The value to write. - Only required when C(state=present). type: raw domain: default: NSGlobalDomain description: - The domain is a domain name of the form C(com.companyname.appname). type: str array_add: default: false description: - Add new elements to the array for a key which has an array as its value. type: bool