I use Vagrant Manager to keep track of my projects. I recently updated to the latest version of Vagrant Manager (2.4.2). It now no longer tracks any of my VMs properly. Upon reading their change log, they seem to be now tracking vm’s using ‘vagrant global-status --prune’.
Upon running this command in CLI, I get the following error:
There was an error loading a Vagrantfile. The file being loaded
and the error message are shown below. This is usually caused by
a syntax error.
Line number: 17
Message: RuntimeError: ansible/group_vars/development file not found. Please set `ANSIBLE_PATH` in Vagrantfile
Though I did set the ANSIBLE_PATH in said file to the following:
ANSIBLE_PATH = 'ansible' # path targeting Ansible directory (relative to Vagrantfile)
Any ideas? Suggestions? I have no problem running the VM at all manually.
@nathan_roca I think that the
vagrant global-status command is reading Vagrantfile info from a different directory context than the original Vagrantfiles, so the relative path
ANSIBLE_PATH = 'ansible' is failing.
Could you edit your Vagrantfile like below to make it an absolute path and see if it resolves the issue?
ANSIBLE_PATH = File.join(__dir__, 'ansible')
It seems this might be the issue. As I replace it in the project the error shows, the next time I run global-status it moves on to the next project. Updating each project (I have about 15 of them) individually and going to see if that completely solves it.
Upon updating all of my projects as the error changed, Vagrant Manager is now working as intended. Has this issue been resolved with Trellis? I have yet to create a new roots/bedrock project since the move to Trellis.
@nathan_roca Thank you for this dialogue. It prompted some improvements in the docs and code comments.
Trellis was correctly using an absolute path:
ANSIBLE_PATH = __dir__.
roots/trellis#292 updates the code comment to suggest using an absolute path.
The example project was still using a relative path:
ANSIBLE_PATH = 'ansible'.
roots/roots-example-project.com#21 fixes this to use
File.join(__dir__, 'ansible') and updates related notes in the README.