Error running vagrant provisioner when default vagrant share is disabled

If you have disabled the default vagrant shared directory

config.vm.synced_folder '.', '/vagrant', disabled: true

You will get the following error using a provisioner:

==> default: Running provisioner: ansible_local...
default: Installing Ansible...
default: Running ansible-playbook...
cd /vagrant && PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true ansible-playbook --limit="default" --inventory-file=/tmp/vagrant-ansible/inventory -v /ansible/init.yml
bash: line 3: cd: /vagrant: No such file or directory
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

To fix, set the provisioning_path configuration:

config.vm.provision "ansible_local" do |ansible|
ansible.provisioning_path = "/ansible"
end

Leave a Reply

Your email address will not be published. Required fields are marked *