0
votes

I am trying to install JQ on mac using this Playbook.
Homebrew has been installed in the target machine manually.

- name: install jq using homebrew
  homebrew:
    name: jq
    state: present

when I run this, I am facing below error

fatal: [X.X.X.X]: FAILED! => {"changed": false, "msg": "Failed to find required executable brew in paths: /Users/xxxx/Documents/ansible/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin"}

Can anyone help me with this?

1
You normally need /usr/local/bin in your PATH to use brew or anything it installs. - Mark Setchell
@MarkSetchell so you mean to tell need to have /usr/local/bin path in target machine??? can you please suggest me to resolve this? As of now used macports to install jq, but would like to know about homebrew also - ZAriel
I don't know anything about "Playbooks". All I am saying is that if you want to run brew install jq you will likely need your PATH to contain /usr/local/bin And if you subsequently want to use jq, you will also need it in your PATH. So export PATH=/usr/local/bin:$PATH - Mark Setchell

1 Answers

1
votes

I am less familiar with using Ansible playbooks for installing brew formulae, but based on the provided PATH, I think you did miss /usr/local/bin (as Mark commented).

Reading this Ansible documentation, did you install the homebrew module as well? If you have brew present in a different PATH, you can certainly modify your syntax as

# Install formula foo with 'brew' in alternate path C(/my/other/location/bin)
- name: install jq using homebrew
  homebrew:
    name: jq
    path: /my/other/location/bin
    state: present