diff --git a/plugins/provisioners/ansible/cap/guest/pip/pip.rb b/plugins/provisioners/ansible/cap/guest/pip/pip.rb index fd9aa319e..ead4e8bf1 100644 --- a/plugins/provisioners/ansible/cap/guest/pip/pip.rb +++ b/plugins/provisioners/ansible/cap/guest/pip/pip.rb @@ -6,14 +6,16 @@ module VagrantPlugins module Pip def self.pip_install(machine, package, version = "", pip_args = "", upgrade = true) - upgrade_arg = "--upgrade " if upgrade + upgrade_arg = "--upgrade" if upgrade version_arg = "" if !version.to_s.empty? && version.to_s.to_sym != :latest version_arg = "==#{version}" end - machine.communicate.sudo "pip install #{pip_args} #{upgrade_arg}#{package}#{version_arg}" + args_array = [pip_args, upgrade_arg, "#{package}#{version_arg}"] + + machine.communicate.sudo "pip install #{args_array.join(' ')}" end def self.get_pip(machine) diff --git a/website/source/docs/provisioning/ansible_local.html.md b/website/source/docs/provisioning/ansible_local.html.md index a8e393b92..40e03f786 100644 --- a/website/source/docs/provisioning/ansible_local.html.md +++ b/website/source/docs/provisioning/ansible_local.html.md @@ -79,8 +79,9 @@ This section lists the _specific_ options for the Ansible Local provisioner. In The default value is `:default`, and any invalid value for this option will silently fall back to the default value. -- `pip_args` (string) - When Ansible is installed via pip this option allows the defition of additional pip arguments to be passed along on the -command line (for example, [--index-url](https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-i)). +- `pip_args` (string) - When Ansible is installed via pip, this option allows the definition of additional pip arguments to be passed along on the command line (for example, [`--index-url`](https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-i)). + + By default, this option is not set. - `provisioning_path` (string) - An absolute path on the guest machine where the Ansible files are stored. The `ansible-galaxy` and `ansible-playbook` commands are executed from this directory. This is the location to place an [ansible.cfg](http://docs.ansible.com/ansible/intro_configuration.html) file, in case you need it.