diff --git a/plugins/provisioners/ansible/provisioner/host.rb b/plugins/provisioners/ansible/provisioner/host.rb index 929c66542b5..15842b7a1b4 100644 --- a/plugins/provisioners/ansible/provisioner/host.rb +++ b/plugins/provisioners/ansible/provisioner/host.rb @@ -233,6 +233,9 @@ def prepare_ansible_ssh_args proxy_cmd += " exec nc %h %p 2>/dev/null" + ssh_options << "-o ProxyCommand='#{ proxy_cmd }'" + elsif @machine.ssh_info[:proxy_command] && @machine.provider_config.connect_via_ssh + proxy_cmd = @machine.ssh_info[:proxy_command] ssh_options << "-o ProxyCommand='#{ proxy_cmd }'" end