diff --git a/lib/vagrant/errors.rb b/lib/vagrant/errors.rb index d37695f31..beef04c79 100644 --- a/lib/vagrant/errors.rb +++ b/lib/vagrant/errors.rb @@ -87,6 +87,10 @@ module Vagrant error_key(:active_machine_with_different_provider) end + class AnsiblePlaybookAppNotFound < VagrantError + error_key(:ansible_playbook_app_not_found) + end + class BaseVMNotFound < VagrantError error_key(:base_vm_not_found) end diff --git a/plugins/provisioners/ansible/provisioner.rb b/plugins/provisioners/ansible/provisioner.rb index e70e2bc0b..e4284fe6e 100644 --- a/plugins/provisioners/ansible/provisioner.rb +++ b/plugins/provisioners/ansible/provisioner.rb @@ -30,10 +30,14 @@ module VagrantPlugins :notify => [:stdout, :stderr] } - Vagrant::Util::Subprocess.execute(*command) do |type, data| - if type == :stdout || type == :stderr - @machine.env.ui.info(data.chomp, :prefix => false) + begin + Vagrant::Util::Subprocess.execute(*command) do |type, data| + if type == :stdout || type == :stderr + @machine.env.ui.info(data.chomp, :prefix => false) + end end + rescue Vagrant::Util::Subprocess::LaunchError + raise Vagrant::Errors::AnsiblePlaybookAppNotFound end end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 24ba371ab..3c243604d 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -66,6 +66,14 @@ en: Machine name: %{name} Active provider: %{active_provider} Requested provider: %{requested_provider} + ansible_playbook_app_not_found: |- + The "ansible-playbook" program could not be found! Please verify + that "ansible-playbook" is available on the PATH of your host + system, and try again. + + If you haven't installed Ansible yet, please install Ansible + on your system. Vagrant can't do this for you in a safe, automated + way. Please see ansible.cc for more info. base_vm_not_found: The base VM with the name '%{name}' was not found. batch_multi_error: |- An error occurred while executing multiple actions in parallel.