community.general.homebrew module – Package manager for Homebrew
Note
This module is part of the community.general collection (version 10.0.1).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.homebrew
.
Synopsis
Manages Homebrew packages
Requirements
The below requirements are needed on the host that executes this module.
homebrew must already be installed on the target system
Parameters
Parameter |
Comments |
---|---|
Force the package(s) to be treated as a formula (equivalent to To install a cask, use the community.general.homebrew_cask module. Choices:
|
|
options flags to install a package. |
|
A list of names of packages to install/remove. |
|
A Default: |
|
state of the package. Choices:
|
|
update homebrew itself first. Choices:
|
|
upgrade all homebrew packages. Choices:
|
|
Option flags to upgrade. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: full |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Notes
Note
When used with a
loop:
each package will be processed individually, it is much more efficient to pass the list directly to thename
option.
Examples
# Install formula foo with 'brew' in default path
- community.general.homebrew:
name: foo
state: present
# Install formula foo with 'brew' in alternate path (/my/other/location/bin)
- community.general.homebrew:
name: foo
path: /my/other/location/bin
state: present
# Update homebrew first and install formula foo with 'brew' in default path
- community.general.homebrew:
name: foo
state: present
update_homebrew: true
# Update homebrew first and upgrade formula foo to latest available with 'brew' in default path
- community.general.homebrew:
name: foo
state: latest
update_homebrew: true
# Update homebrew and upgrade all packages
- community.general.homebrew:
update_homebrew: true
upgrade_all: true
# Miscellaneous other examples
- community.general.homebrew:
name: foo
state: head
- community.general.homebrew:
name: foo
state: linked
- community.general.homebrew:
name: foo
state: absent
- community.general.homebrew:
name: foo,bar
state: absent
- community.general.homebrew:
name: foo
state: present
install_options: with-baz,enable-debug
- name: Install formula foo with 'brew' from cask
community.general.homebrew:
name: homebrew/cask/foo
state: present
- name: Use ignore-pinned option while upgrading all
community.general.homebrew:
upgrade_all: true
upgrade_options: ignore-pinned
- name: Force installing a formula whose name is also a cask name
community.general.homebrew:
name: ambiguous_formula
state: present
force_formula: true
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
List of package names which are changed after module run Returned: success Sample: |
|
if the cache was updated or not Returned: always Sample: |
|
List of package names which are unchanged after module run Returned: success Sample: |