Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bonniss/82e2fdda4f9586e07ca03b436cbd6bd7 to your computer and use it in GitHub Desktop.
Save bonniss/82e2fdda4f9586e07ca03b436cbd6bd7 to your computer and use it in GitHub Desktop.
Install MacOS Homebrew Packages With Ansible
---
- name: Install MacOS Packages
hosts: localhost
become: false
vars:
brew_cask_packages:
- atom
- docker
- dropbox
- firefox
- google-chrome
- google-drive
- google-hangouts
- iterm2
- keepassx
- kodi
- lastpass
- macvim
- royal-tsx
- skype
- slack
- sling
- spotify
- sublime-text
- vagrant
- vagrant-manager
- virtualbox
- virtualbox-extension-pack
- visual-studio-code
- vmware-fusion
brew_packages:
- autoconf
- bash-completion
- boot2docker
- consul
- docker-compose
- docker-machine
- doxygen
- git
- git-lfs
- go
- jq
- nmap
- nomad
- openssl
- packer
- pyenv
- python
- rancher-compose
- rbenv
- ruby-build
- ssh-copy-id
- terraform
- terraform-inventory
- terraform-provisioner-ansible
- tmux
- tree
- vault
- wget
- zsh
- zsh-syntax-highlighting
install_homebrew_if_missing: false
# python_modules:
# - configparser
# - pylint
# - virtualenv
upgrade_homebrew_packages: false
pre_tasks:
- name: Ensuring Homebrew Is Installed
stat:
path: /usr/local/bin/brew
register: homebrew_check
- name: Fail If Homebrew Is Not Installed and install_homebrew_if_missing Is False
fail:
msg: Homebrew is missing...Install from http://brew.sh/
when:
- not homebrew_check.stat.exists
- not install_homebrew_if_missing
- name: Installing Homebrew
shell: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
when:
- not homebrew_check.stat.exists
- install_homebrew_if_missing
tasks:
- name: Updating Homebrew
homebrew:
update_homebrew: true
when: homebrew_check.stat.exists
- name: Upgrading Homebrew Packages
homebrew:
upgrade_all: "{{ upgrade_homebrew_packages }}"
register: result
until: result is successful
when: homebrew_check.stat.exists
- name: Installing Homebrew Cask Packages
homebrew_cask:
name: "{{ brew_cask_packages }}"
state: present
register: result
until: result is successful
when: homebrew_check.stat.exists
- name: Installing Homebrew Packages
homebrew:
name: "{{ brew_packages }}"
state: present
register: result
until: result is successful
when: homebrew_check.stat.exists
# - name: Installing Python Modules
# pip:
# name: "{{ item }}"
# state: present
# with_items: '{{ python_modules }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment