community.general.homebrew_cask 模块 – 安装和卸载 Homebrew Casks
注意
此模块是 community.general 集合(版本 10.1.0)的一部分。
如果您正在使用 ansible 包,您可能已经安装了这个集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用:ansible-galaxy collection install community.general。
要在 Playbook 中使用它,请指定:community.general.homebrew_cask。
概要
- 管理 Homebrew Casks。 
参数
| 参数 | 注释 | 
|---|---|
| 允许外部应用。 选项 
 | |
| 升级自动更新的 Casks。 当检查已安装的 Cask 是否有更新的版本可用时,将  选项 
 | |
| 用于安装软件包的选项标志。 | |
| 要安装或删除的 Cask 的名称。 | |
| 以“:”分隔的路径列表,用于搜索“brew”可执行文件。 默认值:  | |
| Cask 的状态。 选项 
 | |
| 要传递给 SUDO_ASKPASS 的 sudo 密码。 | |
| 首先更新 Homebrew 本身。 请注意, 选项 
 | |
| 升级所有 Casks。 与  选项 
 | 
属性
| 属性 | 支持 | 描述 | 
|---|---|---|
| 支持:完整 | 可以在  | |
| 支持:无 | 当处于 diff 模式时,将返回已更改(或可能需要在  | 
示例
- name: Install cask
  community.general.homebrew_cask:
    name: alfred
    state: present
- name: Remove cask
  community.general.homebrew_cask:
    name: alfred
    state: absent
- name: Install cask with install options
  community.general.homebrew_cask:
    name: alfred
    state: present
    install_options: 'appdir=/Applications'
- name: Install cask with install options
  community.general.homebrew_cask:
    name: alfred
    state: present
    install_options: 'debug,appdir=/Applications'
- name: Install cask with force option
  community.general.homebrew_cask:
    name: alfred
    state: present
    install_options: force
- name: Allow external app
  community.general.homebrew_cask:
    name: alfred
    state: present
    accept_external_apps: true
- name: Remove cask with force option
  community.general.homebrew_cask:
    name: alfred
    state: absent
    install_options: force
- name: Upgrade all casks
  community.general.homebrew_cask:
    upgrade_all: true
- name: Upgrade all casks with greedy option
  community.general.homebrew_cask:
    upgrade_all: true
    greedy: true
- name: Upgrade given cask with force option
  community.general.homebrew_cask:
    name: alfred
    state: upgraded
    install_options: force
- name: Upgrade cask with greedy option
  community.general.homebrew_cask:
    name: 1password
    state: upgraded
    greedy: true
- name: Using sudo password for installing cask
  community.general.homebrew_cask:
    name: wireshark
    state: present
    sudo_password: "{{ ansible_become_pass }}"
