This is an Ansible module for creating and manipulating plists.
To install this module copy the library
folder to the location of your playlist or role. The script makes use of biplist so make sure to install it on the targeted system.
- name: Install pip
easy_install: name=pip
sudo: yes
- name: Install python module dependencies
pip: name=biplist
sudo: yes
The module takes three arguments:
dest
(Required): Either the absolute path of the plist, or a domain/filename which will be searched for in~/Library/Preferences/<domain>.plist
key
(Optional): The key of write the value to. If not given it is written to the root node.value
(Required): The value to write. It may be astring
,int
,float
,boolean
,array
ordictionary
. Nested dictionaries are allowed and are inclusive, i.e. nested keys that are only present in the current plist file will not be deleted.
This module supports check mode.
- name: example 1
plist_file:
dest: /tmp/example.plist
key: myString
value: myValue
- name: Change Dock settings
plist_file:
dest: com.apple.dock
value:
# One of left, bottom, right
orientation: left
# Mission Control animation speed
expose-animation-duration: 0.1
- The
date
anddata
types are not supported.
A simple test can be run with:
$ cd test
$ ./run.sh
This module is released under the MIT License.