osx_defaults - osx_defaults allows users to read, write, and delete macOS user defaults from Ansible

New in version 2.0.

Synopsis

Parameters

Parameter Choices/Defaults Comments
array_add
bool
    Choices:
  • no ←
  • yes
Add new elements to the array for a key which has an array as its value.
domain Default:
NSGlobalDomain
The domain is a domain name of the form com.companyname.appname.
host
(added in 2.1)
The host on which the preference should apply. The special value "currentHost" corresponds to the "-currentHost" switch of the defaults commandline tool.
key
required
The key of the user preference
state
    Choices:
  • present ←
  • absent
The state of the user defaults
type
    Choices:
  • array
  • bool
  • boolean
  • date
  • float
  • int
  • integer
  • string ←
The type of value to write.
value
The value to write. Only required when state = present.

Notes

Note

  • Apple Mac caches defaults. You may need to logout and login to apply the changes.

Examples

- 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: 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

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Franck Nijhof (@frenck)

Hint

If you notice any issues in this documentation you can edit this document to improve it.