Ansible Osx

Name: Run.osx dotfiles. Shell: /.osx -no-restart changedwhen: false. Under the vars folder main.yml file is a list of several Homebrew packages. Run Installation. Open a Termial, go to the directory: cd /gits/siyelo/laptop/ Run Ansible: ansible-playbook playbook.yml -i hosts –ask-sudo-pass -vvvv Press the return key to invoke the command. So, I started my Ansible work using a local Ubuntu 18.04 virtual machine. This provided a real level of safe isolation, but I soon found that managing it was tedious. I set out to see how to get a flexible but isolated Ansible system on native MacOS. Since Ansible is based on Python, Conda seemed to be the ideal solution. Installing Conda. 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.

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.

For previous versions, see the documentation archive. Installation, Upgrade & Configuration. Installation Guide. Basics / What Will Be Installed. Ansible uses Python and fortunately Python is already installed on modern versions of OSX. Sudo easyinstall pip. Sudo pip install ansible -quiet. Then, if you would like to update Ansible later, just do: sudo pip install ansible -upgrade.

Installation of Applications and packages

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:

Osx
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:

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'

Mac OS X tweaks

Ansible Osx Brew

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.