From f516019cbae72d0f0459640e1a26e130ac7ad870 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilets Date: Wed, 24 Aug 2016 17:07:04 +0200 Subject: [PATCH 1/2] support ansible for remote servers and vm --- plugins/provisioners/ansible/provisioner/host.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/provisioners/ansible/provisioner/host.rb b/plugins/provisioners/ansible/provisioner/host.rb index 929c66542b5..7d298ffce7b 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.provider_name == :libvirt && @machine.provider_config.connect_via_ssh + proxy_cmd = @machine.ssh_info[:proxy_command] ssh_options << "-o ProxyCommand='#{ proxy_cmd }'" end From 2ebbfdf78aa4caeb7a10ca71dce07f4e228505fb Mon Sep 17 00:00:00 2001 From: Dmitry Vasilets Date: Mon, 19 Sep 2016 21:00:14 +0200 Subject: [PATCH 2/2] changes after review --- plugins/provisioners/ansible/provisioner/host.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/provisioners/ansible/provisioner/host.rb b/plugins/provisioners/ansible/provisioner/host.rb index 7d298ffce7b..15842b7a1b4 100644 --- a/plugins/provisioners/ansible/provisioner/host.rb +++ b/plugins/provisioners/ansible/provisioner/host.rb @@ -234,7 +234,7 @@ def prepare_ansible_ssh_args proxy_cmd += " exec nc %h %p 2>/dev/null" ssh_options << "-o ProxyCommand='#{ proxy_cmd }'" - elsif @machine.provider_name == :libvirt && @machine.provider_config.connect_via_ssh + 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