community.general.homebrew (8.5.0) — module

Package manager for Homebrew

Authors: Indrajit Raychaudhuri (@indrajitr), Daniel Jaouen (@danieljaouen), Andrew Dunham (@andrew-d)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manages Homebrew packages


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install formula foo with 'brew' in default path
- community.general.homebrew:
    name: foo
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Install formula foo with 'brew' in alternate path (/my/other/location/bin)
- community.general.homebrew:
    name: foo
    path: /my/other/location/bin
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Update homebrew first and install formula foo with 'brew' in default path
- community.general.homebrew:
    name: foo
    state: present
    update_homebrew: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Update homebrew and upgrade all packages
- community.general.homebrew:
    update_homebrew: true
    upgrade_all: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Miscellaneous other examples
- community.general.homebrew:
    name: foo
    state: head
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- community.general.homebrew:
    name: foo
    state: linked
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- community.general.homebrew:
    name: foo
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- community.general.homebrew:
    name: foo,bar
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- community.general.homebrew:
    name: foo
    state: present
    install_options: with-baz,enable-debug
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install formula foo with 'brew' from cask
  community.general.homebrew:
    name: homebrew/cask/foo
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Use ignore-pinned option while upgrading all
  community.general.homebrew:
    upgrade_all: true
    upgrade_options: ignore-pinned

Inputs

    
name:
    aliases:
    - formula
    - package
    - pkg
    description:
    - A list of names of packages to install/remove.
    elements: str
    type: list

path:
    default: /usr/local/bin:/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin
    description:
    - A V(:) separated list of paths to search for C(brew) executable. Since a package
      (I(formula) in homebrew parlance) location is prefixed relative to the actual path
      of C(brew) command, providing an alternative C(brew) path enables managing different
      set of packages in an alternative location in the system.
    type: path

state:
    choices:
    - absent
    - head
    - installed
    - latest
    - linked
    - present
    - removed
    - uninstalled
    - unlinked
    - upgraded
    default: present
    description:
    - state of the package.
    type: str

upgrade_all:
    aliases:
    - upgrade
    default: false
    description:
    - upgrade all homebrew packages.
    type: bool

install_options:
    aliases:
    - options
    description:
    - options flags to install a package.
    elements: str
    type: list

update_homebrew:
    default: false
    description:
    - update homebrew itself first.
    type: bool

upgrade_options:
    description:
    - Option flags to upgrade.
    elements: str
    type: list
    version_added: 0.2.0
    version_added_collection: community.general

Outputs

changed_pkgs:
  description:
  - List of package names which are changed after module run
  returned: success
  sample:
  - git
  - git-cola
  type: list
  version_added: 0.2.0
  version_added_collection: community.general
msg:
  description: if the cache was updated or not
  returned: always
  sample: 'Changed: 0, Unchanged: 2'
  type: str
unchanged_pkgs:
  description:
  - List of package names which are unchanged after module run
  returned: success
  sample:
  - awscli
  - ag
  type: list
  version_added: 0.2.0
  version_added_collection: community.general