Ansible: Support SSH-Forwarding
Credits: Problem was originally reported in
dba02f3526
by @picsolvebryan
This commit is contained in:
parent
ca1e30d405
commit
9480edf05a
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue