Skip to content

Instantly share code, notes, and snippets.

@MrNice
Created November 21, 2015 01:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrNice/01113bcf0dd0ae682ec1 to your computer and use it in GitHub Desktop.
Save MrNice/01113bcf0dd0ae682ec1 to your computer and use it in GitHub Desktop.
Ansible Mac OS X install app w/ brew and add to the Dock
# TODO: Get version from registering output of brew cask install
- name: "install browser: {{ browser }}"
homebrew_cask: >
name={{ browser }}
state=present
- name: read defaults to know what to add to the dock
shell: defaults read com.apple.dock
register: apple_defaults
- name: "add {{ browser }} to the dock"
vars:
brew_name: google-chrome
app_name: "Google Chrome"
version: latest
shell: defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/opt/homebrew-cask/Caskroom/{{ brew_name }}/{{ version }}/{{ app_name }}.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
when: apple_defaults.stdout.find(app_name) == -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment