I use the following block to detect if homebrew is already installed. In a new version, homebrew it is installed in the /opt/ folder and my “solution” is no longer working. What is a better way to check if a command is available?
- name: Check if homebrew is installed
stat:
path: "/usr/local/bin/brew"
register: "homebrew_check"
Considerations I know which and command -v but assumed there should be something in Ansible itself, am I wrong?