A script to create SSH connection sharing control path
(alsmost) the same way ansible does it. Requires
[ssh_connection]
ssh_args = -C -o ControlMaster=auto -o ControlPath="~/.ssh/controls/%r@%h:%p" -o ControlPersist=600
in `~/.ansible.cfg`.
--- /dev/null
+#! /bin/sh
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 host [port]" >&2
+ exit 1
+fi
+
+exec ssh -C -o ControlMaster=auto -o ControlPath="$HOME/.ansible/cp/ansible-ssh-%h-%p-%r" -o ControlPersist=600 "$1" -p "${2:-22}"