Ansible:homebrew_cask 抛出 "Invalid cask: XXX"

Ansible: homebrew_cask throws "Invalid cask: XXX"

我正在学习 Ansible,我正在尝试使用 Ansible 的 homebrew_taphomebrew_cask:

转换这些 Homebrew 命令
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font

我的 Ansible 剧本如下所示:

---
- name: test
  hosts: localhost
  tasks:
  - name: Tapping homebrew/cask-fonts
    homebrew_tap:
      name: homebrew/cask-fonts

  - name: Installing Nerd Font
    homebrew_cask:
      name: font-hack-nerd-font

当我 运行 它时,我得到这个错误:

PLAY [test] ****************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *****************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Tapping homebrew/cask-fonts] *****************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Installing Nerd Font] ************************************************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Invalid cask: font-hack-nerd-font."}

PLAY RECAP *****************************************************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

我希望能够直接使用 homebrew_cask 而无需 brew 命令来完成此操作。

非常感谢任何指导。谢谢。

reported as a bug due to hyphen(s) in the cask package name. This bug is resolved via pull request