Use osx_defaults module for part of .osx provisioning #79
+14
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found it very weird that many people who provision their Macs using Ansible still use a bash script (the
.osx
dotfile) to set some settings.That's why I started looking into converting all of that into Ansible tasks, because replacing all bash scripts with Ansible seems to be a good thing to do.
At the moment this change allows to move all
defaults
commands from the.osx
script to theconfig.yml
for this playbook. Other parts of the.osx
script will be harder to implement, because I did not find readily usable roles or modules for those yet.This Task is configured by the variable
osx_defaults
and activated by settingosx_use_defaults
totrue
. I have also addedosx_use_dotfile
to determine if the.osx
script should be run. The default behaviour of the playbook should not have changed. So if you merge this and don't touch your custom config, everything should be the same as before.The
osx_defaults
variable is a list of defaults that can be directly transcribed from thedefaults
command used in many.osx
scripts, for example:defaults write NSGlobalDomain AppleInterfaceStyle -string "Dark"
becomes
Feel free to propose changes do this, including ideas about how to implement the commands
pmset
,launchctl
andtmutil
via Ansible.