From 1c0bc20d215f10394d9fe5ef905664da90feab31 Mon Sep 17 00:00:00 2001 From: Gilles Cornu Date: Sun, 9 Mar 2014 22:41:36 +0100 Subject: [PATCH] Ansible: Re-enable ControlPersist defaults when ANSIBLE_SSH_ARGS is used Solve problem discussed in [GH-2952] --- plugins/provisioners/ansible/provisioner.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/provisioners/ansible/provisioner.rb b/plugins/provisioners/ansible/provisioner.rb index fe39f19d1..218d469b4 100644 --- a/plugins/provisioners/ansible/provisioner.rb +++ b/plugins/provisioners/ansible/provisioner.rb @@ -189,6 +189,15 @@ module VagrantPlugins # SSH Forwarding ssh_options << "-o ForwardAgent=yes" if @ssh_info[:forward_agent] + # Re-enable ControlPersist Ansible defaults, + # which are lost when ANSIBLE_SSH_ARGS is defined. + unless ssh_options.empty? + ssh_options << "-o ControlMaster=auto" + ssh_options << "-o ControlPersist=60s" + # Intentionally keep ControlPath undefined to let ansible-playbook + # automatically sets this option to Ansible default value + end + ssh_options.join(' ') end