Last month I updated my development machine to the shiny new El Capitan. Unfortunately as a zsh and tmux user I ran into a very annoying bug and so I was forced to re-install my MBP with Yosemite. Because I belong to the power users which tend to customise their installations a lot and because I like automation I decided I was going to automate this cumbersome job for once and for all. Of course, with my favourite configuration management tool: Ansible.
It appears I’m not the only one and found Jeff Geerling’s excellent mac-dev-playbook repository. The README.md
contains a lot of useful information and the repository is an excellent starting point. I’ve also used it as starting point for my own repository. In this post I’ll explain the most important details of my setup.
Installation of Applications and packages
The Helm community provides the ability to install Helm through operating system package managers. These are not supported by the Helm project and are not considered trusted 3rd parties. From Homebrew (macOS) Members of the Helm community have contributed a Helm formula build to Homebrew. This formula is generally up to date. DOWNLOAD THE PROJECT FILE. Linux or Mac OS X computer. What is Ansible? Ansible is an open-source IT automation platform. OSX Playbook WIP An Ansible Playbook for web developers using OS X. Getting Started. Use the next commands to install ansible and run the playbooks.
I like Homebrew to install packages on my Mac so that’s also what I use in my Ansible setup. There is a ready to use Ansible role available – also created by Jeff Geerling – which I recommend. To use it:
To configure the role to suit your needs you have to edit vars/main.yml
. My current version as an example:
2 4 6 8 10 12 | - name: Remove all crap from Dock ignore_errors: true shell: dockutil --find '{{item.name}}' || dockutil --add '{{item.path}}' shell: dockutil --move '{{item.name}}'--position{{item.pos}} |
Vars:
Ansible Mac Os X Downloads
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 | -Launchpad -Safari -Notes -Maps -Messages -iTunes -AppStore -Calendar dockitems_to_persist: path: '/Applications/Google Chrome.app' - name: Firefox pos: 2 path: /Applications/PhpStorm.app - name: Slack pos: 4 path: /Applications/VirtualBox.app - name: Terminal pos: 6 path: /Applications/Spotify.app |
Terminal
I spend a significant amount of the day in the terminal, so I’ve tweaked the default Terminal settings a lot. The cool thing is these settings can be exported via Shell > Export settings. The Ansible task to import such a file:
2 4 6 8 10 12 14 16 | shell: defaults read com.apple.Terminal 'Default Window Settings' changed_when: false - name: Ensure custom Terminal profile is added. changed_when: false when: 'Solarized-Dark' not in terminal_theme.stdout' - name: Ensure custom Terminal profile is set as default. with_items: - defaults write com.apple.Terminal 'Default Window Settings' -string 'Solarized-Dark' - defaults write com.apple.Terminal 'Startup Window Settings' -string 'Solarized-Dark' when: ''Solarized Dark ansi'notinterminal_theme.stdout' |
Ansible Mac Os X Download Iso
Mac OS X tweaks
Mac Os Ansible
A lot of people don’t know you can configure a lot of settings via the command line interface to the user defaults
. You can read and write these settings. For some inspiration take a look at my defaults.