Ansible: Support SSH-Forwarding

Credits: Problem was originally reported in
dba02f3526
by @picsolvebryan
This commit is contained in:
Bryan Hunt 2014-02-10 10:32:47 +01:00 committed by Gilles Cornu
parent ca1e30d405
commit 9480edf05a
1 changed files with 5 additions and 2 deletions

View File

@ -6,7 +6,7 @@ module VagrantPlugins
ssh = @machine.ssh_info
# Connect with Vagrant SSH identity, forcing 'ssh' ansible connection mode
# as 'paramiko' mode cannot support multiple keys.
# as 'paramiko' mode cannot support multiple keys and ssh-forwarding.
# These default settings can be overridden by 'raw_arguments' option.
options = %W[--connection=ssh --private-key=#{ssh[:private_key_path][0]} --user=#{ssh[:username]}]
@ -41,7 +41,7 @@ module VagrantPlugins
# on a task-by-task basis.
"PYTHONUNBUFFERED" => 1
}
# Support Multiple SSH keys:
# Support Multiple SSH keys and SSH forwarding:
ansible_ssh_args = get_ansible_ssh_args
env["ANSIBLE_SSH_ARGS"] = ansible_ssh_args if !ansible_ssh_args.empty?
@ -164,6 +164,9 @@ module VagrantPlugins
ssh_options << "-o IdentityFile=#{key}"
end
# SSH Forwarding
ssh_options << "-o ForwardAgent=yes" if ssh[:forward_agent]
return ssh_options.join(' ')
end