community.general.homebrew_cask (8.5.0) — module

Install and uninstall homebrew casks

Authors: Indrajit Raychaudhuri (@indrajitr), Daniel Jaouen (@danieljaouen), Enric Lluelles (@enriclluelles)

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 casks.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install cask
  community.general.homebrew_cask:
    name: alfred
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove cask
  community.general.homebrew_cask:
    name: alfred
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install cask with install options
  community.general.homebrew_cask:
    name: alfred
    state: present
    install_options: 'appdir=/Applications'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install cask with install options
  community.general.homebrew_cask:
    name: alfred
    state: present
    install_options: 'debug,appdir=/Applications'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install cask with force option
  community.general.homebrew_cask:
    name: alfred
    state: present
    install_options: force
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Allow external app
  community.general.homebrew_cask:
    name: alfred
    state: present
    accept_external_apps: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove cask with force option
  community.general.homebrew_cask:
    name: alfred
    state: absent
    install_options: force
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade all casks
  community.general.homebrew_cask:
    upgrade_all: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade all casks with greedy option
  community.general.homebrew_cask:
    upgrade_all: true
    greedy: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade given cask with force option
  community.general.homebrew_cask:
    name: alfred
    state: upgraded
    install_options: force
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Upgrade cask with greedy option
  community.general.homebrew_cask:
    name: 1password
    state: upgraded
    greedy: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Using sudo password for installing cask
  community.general.homebrew_cask:
    name: wireshark
    state: present
    sudo_password: "{{ ansible_become_pass }}"

Inputs

    
name:
    aliases:
    - cask
    - package
    - pkg
    description:
    - Name of cask to install or remove.
    elements: str
    type: list

path:
    default: /usr/local/bin:/opt/homebrew/bin
    description:
    - ''':'' separated list of paths to search for ''brew'' executable.'
    type: path

state:
    choices:
    - absent
    - installed
    - latest
    - present
    - removed
    - uninstalled
    - upgraded
    default: present
    description:
    - State of the cask.
    type: str

greedy:
    default: false
    description:
    - Upgrade casks that auto update.
    - Passes C(--greedy) to C(brew outdated --cask) when checking if an installed cask
      has a newer version available, or to C(brew upgrade --cask) when upgrading all casks.
    type: bool

upgrade_all:
    aliases:
    - upgrade
    default: false
    description:
    - Upgrade all casks.
    - Mutually exclusive with C(upgraded) state.
    type: bool

sudo_password:
    description:
    - The sudo password to be passed to SUDO_ASKPASS.
    required: false
    type: str

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

update_homebrew:
    default: false
    description:
    - Update homebrew itself first.
    - Note that C(brew cask update) is a synonym for C(brew update).
    type: bool

accept_external_apps:
    default: false
    description:
    - Allow external apps.
    type: bool