Getting a “ERROR! Trellis no longer supports Ansible 2.3.1.0.” error? You probably upgraded to the latest Trellis from an older version and now you need Ansible 2.4.0.0 or higher. So how do we upgrade this baby? Well in my case the box I just had the issue at runs Ansible via Homebrew. Also I have one older Trellis version for another site so I want to be able to use the older version from time to time. So I do want to go back to version 2.3.1.0 when need be.
Homebrew Ansible Upgrade
To upgrade my Homebrew installed Ansible I ran:
brew update
and then when I checked the version:
ansible --version ansible 2.3.1.0
I found out it did upgrade, but not to the next version. Silly me. I would need to remove ansible and then so a brew install ansible@2.4 . But then the next time I needed to run 2.3.1.0 I would have to reverse all using two commands. Sounded like doing it with pip was easier which allows version changes with one command and which is recommended by Roots core members.
Ansible Pip Install and Upgrade
So I removed ansible from Homebrew using:
brew remove ansible
brew uninstall --force ansible
and then I installed it with pip like I had on my MBP:
sudo easy_install pip
sudo pip install ansible --quiet
And that worked well. No upgrade needed now as the latest version was grabbed:
ansible --version ansible 2.4.1.0 config file = /Users/jasper/webdesign/ianua.imagewize.com/trellis/ansible.cfg configured module search path = [u'/Users/jasper/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python2.7/site-packages/ansible executable location = /usr/local/bin/ansible python version = 2.7.13 (default, Mar 5 2017, 15:42:57) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
Pip Change Ansible Version
And with pip I can also go back to my older version needed for the older Trellis setup using
sudo pip install ansible==2.3.2.0
Trellis Build
So then I tried another vagrant up to see if I could avoid the error message:
ERROR! Trellis no longer supports Ansible 2.3.1.0. Please upgrade to Ansible 2.4.0.0 or higher. Ansible failed to complete successfully. Any error output should be visible above. Please fix these errors and try again.
vagrant up did work, but the site failed to load so I did another
vagrant provision
The provisioning took quite some time. Clearly first vagrant up had not really completed the installation of the new packages. But that did the trick and I was able to load the site locally and import the database backup. Yay!
And if you get
on an older version you can downgrade with
It’s also recommended to upgrade Trellis, and someone else proposed a clever automated workaround to switch Ansible versions on the fly. https://stackoverflow.com/questions/50474137/roots-trellis-ansible-2-4-error-unexpected-exception-this-is-probably-a/50474138#50474138