Documentation

osx_defaults - osx_defaults allows users to read, write, and delete Mac OS X user defaults from Ansible

New in version 2.0.

Synopsis

osx_defaults allows users to read, write, and delete Mac OS X user defaults from Ansible scripts. Mac OS X applications and other programs use the defaults system to record user preferences and other information that must be maintained when the applications aren’t running (such as default font for new documents, or the position of an Info panel).

Options

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

          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
          

          Notes

          Note

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

          This is an Extras Module

          For more information on what this means please read Extras Modules

          For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.