I'm developing Ansible playbooks for my new dedicated host and learning new Ansible features these days. One of the features required a more recent Ansible version, and that's how I learned about rewriting symlinks for installed packages in Homebrew.
I've confirmed Ansible version:
greys@maverick:~/proj/ansible $ ansible --version ansible 2.4.2.0 config file = /Users/greys/Documents/proj/ansible/ansible.cfg configured module search path = [u'/Users/greys/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /Library/Python/2.7/site-packages/ansible executable location = /usr/local/bin/ansible python version = 2.7.10 (default, Feb 22 2019, 21:55:15) [GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)]
… then upgraded the Ansible bottle in Homebrew:
greys@maverick:~/proj/ansible $ brew install ansible
Updating Homebrew…
==> Auto-updated Homebrew!
Updated Homebrew from 37714b5ce to 78d74a8b2.
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
...
==> Deleted Formulae==> Downloading https://homebrew.bintray.com/bottles/ansible-2.8.4_1.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/93/93eac1e6a31cd36b229f3f66a051840512e198fd0123423d895de87c32ec13c6?gda=exp=1567440871~hmac=6a1d81f750325488002912e069cb58dcb04484e35ba49494b49279dfc2b03c35
################################################################## 100.0%
==> Pouring ansible-2.8.4_1.mojave.bottle.tar.gz
Error: The brew link
step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/ansible
Target /usr/local/bin/ansible
already exists. You may want to remove it:
rm '/usr/local/bin/ansible'
To force the link and overwrite all conflicting files:
brew link --overwrite ansible
To list all files that would be deleted:
brew link --overwrite --dry-run ansible
Possible conflicting files are:
/usr/local/bin/ansible
/usr/local/bin/ansible-config -> /usr/local/bin/ansible
/usr/local/bin/ansible-connection
/usr/local/bin/ansible-console -> /usr/local/bin/ansible
/usr/local/bin/ansible-doc -> /usr/local/bin/ansible
/usr/local/bin/ansible-galaxy -> /usr/local/bin/ansible
/usr/local/bin/ansible-inventory -> /usr/local/bin/ansible
/usr/local/bin/ansible-playbook -> /usr/local/bin/ansible
/usr/local/bin/ansible-pull -> /usr/local/bin/ansible
/usr/local/bin/ansible-vault -> /usr/local/bin/ansible
==> Summary
🍺 /usr/local/Cellar/ansible/2.8.4_1: 15,147 files, 194.8MB
You have new mail in /var/mail/greys
… and then realised Ansible version stayed the same (2.4.2.0) even though installed package was 2.8.4.1…
Overwrite symlinks in Homebrew
Here's a useful command that re-creates (and overwrites) symlinks from /usr/local/bin directory to the latest version of a specified Homebrew bottle, Ansible in my case:
greys@maverick:~/proj/ansible $ brew link --overwrite ansible Linking /usr/local/Cellar/ansible/2.8.4_1… 19 symlinks created
Now le'ts check the version of Ansible again, it should show the correct (latest) version:
greys@maverick:~/proj/ansible $ ansible --version ansible 2.8.4 config file = /Users/greys/Documents/proj/ansible/ansible.cfg configured module search path = ['/Users/greys/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/Cellar/ansible/2.8.4_1/libexec/lib/python3.7/site-packages/ansible executable location = /usr/local/bin/ansible python version = 3.7.4 (default, Jul 9 2019, 18:13:23) [Clang 10.0.1 (clang-1001.0.46.4)]
That's it for now. Enjoy your Ansible experiments!
Leave a Reply