geerlingguy.homebrew
Ansible Role: Homebrew (MOVED)
MOVED: This role has been moved to the geerlingguy.mac collection. Please check this issue for a guide on how to migrate and for more details.
This role installs Homebrew on MacOS and sets up packages, taps, and cask applications based on the given variables.
Requirements
No special requirements.
Role Variables
Here are the available variables with their default values (see defaults/main.yml):
homebrew_repo:
https://github.com/Homebrew/brew- This is the GitHub link for the Homebrew core repository.
homebrew_prefix:
{{ (ansible_machine == 'arm64') | ternary('/opt/homebrew', '/usr/local') }}homebrew_install_path:
{{ homebrew_prefix }}/Homebrew- This defines where Homebrew will be installed. It's best to stick with the default to avoid issues. If you change this, make sure to create a symlink to
/usr/local.
- This defines where Homebrew will be installed. It's best to stick with the default to avoid issues. If you change this, make sure to create a symlink to
homebrew_brew_bin_path:
/usr/local/bin- This is where the
brewcommand will be installed.
- This is where the
homebrew_installed_packages:
- Default:
- ssh-copy-id - pv - { name: vim, install_options: "with-luajit,override-system-vi" } - List of packages to ensure they are installed via
brew install. You can also add installation options.
- Default:
homebrew_uninstalled_packages:
[]- List of packages to ensure they are removed.
homebrew_upgrade_all_packages:
false- Set to
trueto upgrade Homebrew and all installed packages. Keep itfalseif you prefer to do this manually.
- Set to
homebrew_taps:
- Default:
- homebrew/core - { name: my_company/internal_tap, url: 'https://example.com/path/to/tap.git' } - Taps to ensure Homebrew has added.
- Default:
homebrew_cask_apps:
- Default:
- firefox - { name: virtualbox, install_options:"debug,appdir=/Applications" } - Applications to install via
cask. Check for available applications here.
- Default:
homebrew_cask_accept_external_apps:
true- Default is
false, which stops the process if any app fromhomebrew_cask_appsis already installed withoutcask. Set astrueto skip errors in such cases.
- Default is
homebrew_cask_uninstalled_apps:
- Default:
- google-chrome - List of applications to ensure they are removed.
- Default:
homebrew_cask_appdir:
/Applications- Directory for cask-installed applications.
homebrew_use_brewfile:
true- Whether to install using a Brewfile. If yes, you'll need to add the
homebrew/bundletap inhomebrew_taps.
- Whether to install using a Brewfile. If yes, you'll need to add the
homebrew_brewfile_dir:
~- The location of your Brewfile.
homebrew_clear_cache:
false- Set to
trueto clear the Homebrew cache after installing new software.
- Set to
homebrew_user:
{{ ansible_user_id }}- The user under which Homebrew is installed.
homebrew_group:
{{ ansible_user_gid }}- The group to use while installing Homebrew.
homebrew_folders_additional:
[]- Any extra folders in
homebrew_prefixto ensure ownership.
- Any extra folders in
Dependencies
Example Playbook
- hosts: localhost
vars:
homebrew_installed_packages:
- mysql
roles:
- geerlingguy.homebrew
Check the tests/local-testing directory for a sample of how to run this role through Ansible's local connection. Also refer to:
Mac Development Ansible Playbook.
License
Author Information
This role was created in 2014 by Jeff Geerling, the author of Ansible for DevOps.
Maintainer(s)
ansible-galaxy install geerlingguy.homebrew