diff --git a/plugins/provisioners/ansible/config/guest.rb b/plugins/provisioners/ansible/config/guest.rb index a869779ae..13d801ff8 100644 --- a/plugins/provisioners/ansible/config/guest.rb +++ b/plugins/provisioners/ansible/config/guest.rb @@ -11,6 +11,7 @@ module VagrantPlugins attr_accessor :install attr_accessor :install_mode attr_accessor :pip_args + attr_accessor :pip_install_cmd def initialize super @@ -18,6 +19,7 @@ module VagrantPlugins @install = UNSET_VALUE @install_mode = UNSET_VALUE @pip_args = UNSET_VALUE + @pip_install_cmd = UNSET_VALUE @provisioning_path = UNSET_VALUE @tmp_path = UNSET_VALUE end @@ -28,6 +30,7 @@ module VagrantPlugins @install = true if @install == UNSET_VALUE @install_mode = :default if @install_mode == UNSET_VALUE @pip_args = "" if @pip_args == UNSET_VALUE + @pip_install_cmd = "" if @pip_args == UNSET_VALUE @provisioning_path = "/vagrant" if provisioning_path == UNSET_VALUE @tmp_path = "/tmp/vagrant-ansible" if tmp_path == UNSET_VALUE end diff --git a/plugins/provisioners/ansible/provisioner/guest.rb b/plugins/provisioners/ansible/provisioner/guest.rb index ca4953b72..de101e051 100644 --- a/plugins/provisioners/ansible/provisioner/guest.rb +++ b/plugins/provisioners/ansible/provisioner/guest.rb @@ -32,7 +32,10 @@ module VagrantPlugins # # Current limitations: # - The installation of a specific Ansible version is only supported by - # the "pip" install_mode. + # the "pip" install_mode. Note that "pip" installation also takes place + # via a default command. If pip needs to be installed differently then + # the command can be overwritten by supplying "pip_install_cmd" in the + # config settings. # - There is no absolute guarantee that the automated installation will replace # a previous Ansible installation (although it works fine in many cases) # @@ -51,7 +54,7 @@ module VagrantPlugins (config.version.to_s.to_sym == :latest || !@machine.guest.capability(:ansible_installed, config.version)) @machine.ui.detail I18n.t("vagrant.provisioners.ansible.installing") - @machine.guest.capability(:ansible_install, config.install_mode, config.version, config.pip_args) + @machine.guest.capability(:ansible_install, config.install_mode, config.version, config.pip_args, config.pip_install_cmd) end # This step will also fetch the Ansible version data into related instance variables diff --git a/test/unit/plugins/provisioners/ansible/config/guest_test.rb b/test/unit/plugins/provisioners/ansible/config/guest_test.rb index 19010ba94..d3abc431c 100644 --- a/test/unit/plugins/provisioners/ansible/config/guest_test.rb +++ b/test/unit/plugins/provisioners/ansible/config/guest_test.rb @@ -32,6 +32,7 @@ describe VagrantPlugins::Ansible::Config::Guest do inventory_path limit pip_args + pip_install_cmd playbook playbook_command provisioning_path