Error in using homebrew module in ansible

Page content

When I call the homebrew modules for three hosts including the localhost, one host reports error.

mbpr15:~ cychong$ ansible-playbook install_brew_ack.yaml --verbose
No config file found; using defaults

PLAY [all] **************************************************************************************************

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

TASK [install ack in homebrew] ******************************************************************************
ok: [localhost] => {"changed": false, "failed": false, "msg": "Package already installed: ack"}
ok: [mini1] => {"changed": false, "failed": false, "msg": "Package already installed: ack"}
fatal: [mini2]: FAILED! => {"changed": false, "failed": true, "msg": "Warning: git 2.14.2 is already installed\nError: Git must be installed and in your PATH!\nxcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\nError: ack cannot be built with any available compilers.\nInstall GNU's GCC\n  brew install gcc"}
	to retry, use: --limit @/Users/cychong/install_brew_ack.retry

PLAY RECAP **************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0   
mini1                      : ok=2    changed=0    unreachable=0    failed=0   
mini2                      : ok=1    changed=0    unreachable=0    failed=1   

This requires xcrun is not installed. (The following command will have a pop-up window to install command line tool).

$ xcode-select --install

After that, error is gone~

Reference