ansible.builtin.osx_defaults (v2.6.2) — module

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

| "added in version" 2.0 of ansible.builtin"

Authors: Franck Nijhof (@frenck)

stableinterface | supported by community

Install Ansible via pip

Install with pip install ansible==2.6.2

Description

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).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- osx_defaults:
    domain: com.apple.Safari
    key: IncludeInternalDebugMenu
    type: bool
    value: true
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- osx_defaults:
    domain: NSGlobalDomain
    key: AppleMeasurementUnits
    type: string
    value: Centimeters
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- osx_defaults:
    domain: com.apple.screensaver
    host: currentHost
    key: showClock
    type: int
    value: 1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- osx_defaults:
    key: AppleMeasurementUnits
    type: string
    value: Centimeters
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- osx_defaults:
    key: AppleLanguages
    type: array
    value:
      - en
      - nl
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- osx_defaults:
    domain: com.geekchimp.macable
    key: ExampleKeyToRemove
    state: absent

Inputs

    
key:
    description:
    - The key of the user preference
    required: true

host:
    description:
    - The host on which the preference should apply. The special value "currentHost" corresponds
      to the "-currentHost" switch of the defaults commandline tool.
    version_added: '2.1'
    version_added_collection: ansible.builtin

type:
    choices:
    - array
    - bool
    - boolean
    - date
    - float
    - int
    - integer
    - string
    default: string
    description:
    - The type of value to write.

state:
    choices:
    - present
    - absent
    default: present
    description:
    - The state of the user defaults

value:
    description:
    - The value to write. Only required when state = present.

domain:
    default: NSGlobalDomain
    description:
    - The domain is a domain name of the form com.companyname.appname.

array_add:
    default: 'no'
    description:
    - Add new elements to the array for a key which has an array as its value.
    type: bool