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