limc
limc

Reputation: 40176

Ansible: homebrew_cask throws "Invalid cask: XXX"

I'm learning Ansible and I'm trying to convert these Homebrew commands using Ansible's homebrew_tap and homebrew_cask:

brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font

My Ansible playbook looks like this:

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

When I run it, I get this error:

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   

I'm hoping to be able to pull this off using homebrew_cask without brew command directly.

Any guidance is greatly appreciated. Thank you.

Upvotes: 3

Views: 875

Answers (1)

limc
limc

Reputation: 40176

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

Upvotes: 2

Related Questions