- name: Instal required Homebrew Taps
shell: brew tap {{ item }}
with_items: brew_taps
- name: Check homebrew-cask is installed
stat: path=/usr/local/bin/brew-cask.rb
register: brew_cask_installed
- name: Install homebrew-cask
shell: brew install brew-cask
when: brew_cask_installed.stat.exists == false
# - name: Install Cordova
# npm:
#executable: "~/.local/bin/npm"
# name=cordova
#state=present
#global=yes
#version=6.5.0
#become: yes
#become_user: builder
### UTILS
- name: Install libraries/utils with homebrew
homebrew: name={{ item }} state=present
with_items: brew_utils
- name: Cleanup after brewing
shell: brew cleanup
### APPZ
- name: Check for installed apps(casks)
shell: brew cask list | grep {{ item }}
register: installed_applications
with_items: applications
ignore_errors: true
- name: Install Apps with brew-cask
shell: brew cask install {{ item }}
with_items: applications
when: "{{ item not in installed_applications.results|map(attribute='stdout') }}"
# Caveats: megasync only works if called from /Applications
- name: Linking MEGASync with brew-cask
shell: ln -s '/opt/homebrew-cask/Caskroom/megasync/latest/MEGAsync.app' '/Applications/MEGAsync.app'
when: "'megasync' in applications"
ignore_errors: true # hacky
### ZSH radness
- name: Determine if zsh is default/current shell
shell: echo $SHELL
register: current_shell
- name: Enable zsh in /etc/shells
shell: sudo /bin/sh -c 'grep -q "{{ zsh_path }}" /etc/shells || echo "{{ zsh_path }}" >> /etc/shells'
when: current_shell.stdout != '/usr/local/bin/zsh'
#" unbreak my syntax highlighting...
- name: Set zsh as default shell
shell: chsh -s {{ zsh_path }}
when: current_shell.stdout != '/usr/local/bin/zsh'
sudo: true
- name: Use GNU tools instead of osx counterparts (grep find etc)
shell: echo 'export PATH=$(brew --prefix coreutils)/libexec/gnubin:$PATH' >> ~/.zshrc
- name: Install oh-my-zsh
sudo: false
when: install_oh_my_zsh == true
tags: install_oh_my_zsh