Ansible version error on vagrant up

Hi,

I have run into an error on latest trellis release (1.13).

When i vagrant up a project i get an error on ansible install. It requires ansible 2.10.7 but it installs 2.10.17.

Error:

==> default: [vagrant-hostmanager:guests] Updating hosts file on active guest virtual machines...
==> default: [vagrant-hostmanager:host] Updating hosts file on your workstation (password may be required)...
==> default: Running provisioner: ansible_local...
    default: Installing Ansible...
    default: Installing pip... (for Ansible installation)
The requested Ansible version (2.10.7) was not found on the guest.
Please check the Ansible installation on your Vagrant guest system (currently: 2.10.17),
or adapt the provisioner `version` option in your Vagrantfile.
See https://docs.vagrantup.com/v2/provisioning/ansible_common.html#version
for more information.

My vagrant version is 2.2.6
Running virtualbox version 5.2.44 on windows 10.

I don’t know from where it gets this asible version and how can i force the correct version. If i change the version in vagrant file than it’s ok. But i’m not sure if this is a good practice to always change the vagrant file.

Any idea?

Thank you

Howdy! Just checking — are you using trellis-cli?

No. I’m using vagrant command to start and provision virtual box and then i use ansible commands inside virtual enviroment to deploy site.

I’d suggest installing trellis-cli, then running trellis init in your project directory (from WSL) and then run trellis up (also from WSL)

1 Like

As @ben said, trellis-cli should provide better dependency management.

But you can also try changing the version defined here: trellis/vagrant.default.yml at 56582d408054f556e8d634a6308730ec17f75068 · roots/trellis · GitHub

I’m getting this now on different Projects, different Versions of Trellis, using trellis-cli.

I’m using Apple Silicon, Parallels and tried either with Vagrant 2.2.18 and the newest version. Bumping the ansible version to “2.10.17” as the error message tells, getting a new error that the version doesn’t exist …

EDIT: Setting vagrant_ansible_version to “latest” in vagrant.default.yml just skips the error, but doesn’t help. I had this problem more often in the past, provisioning older projects from bitbucket via trellis-cli.

I’ve also been struggling with this lately. I’ve read that there should be a fix coming in Vagrant 2.3.5, whenever it is released.

Have you had any success with updating and reprovisioning older projects? And what did you mean by “skips the error, but doesn’t help”?

I am trying to migrate older projects to Ubuntu 22 and using vagrant_ansible_version: latest seems to do the trick. I mean, I have to destroy the old VirtualBoxes and start fresh anyway.

Highly recommend giving Lima a shot if possible so that you don’t have to use Vagrant or VirtualBox

Any issue with Vagrant and the ansible version is likely because you don’t have Ansible installed on your host machine. When Trellis’ Vagrantfile does not find an Ansible installation, it uses ansible_local (confusingly named) mode which installs and runs Ansible on the Vagrant VM and that’s what is broken due to that Vagrant bug.

The recommend way to install Ansible and any other necessary Trellis dependencies is with trellis-cli by running the trellis init command in your project.

1 Like

6 posts were merged into an existing topic: Ansible_local version mismatch

Here’s a recap since this thread has at least two different causes of the issue:

  1. @klemenz original issue is because he’s running Windows and that defaults to the ansible_local provisioner. @klemenz we require using WSL. If you use WSL, you can use Trellis CLI which will manage Ansible dependencies and should fix this issue.
  2. @abartdigital’s issue could be the same as @conductdesign’s but we don’t know without more details.

@klemenz feel free to follow-up in this thread. @abartdigital since the cause of the issue is almost certainly different, I’d recommend reading through Ansible_local version mismatch - #3 by conductdesign first and if re-installing Python doesn’t fix it, please create a new thread with more details.