]> git.phdru.name Git - ansible.git/commitdiff
Feat: Add `ansible-ssh`
authorOleg Broytman <phd@phdru.name>
Sun, 14 Jul 2019 03:09:45 +0000 (06:09 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 16 Jul 2019 18:28:41 +0000 (21:28 +0300)
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`.

ansible-ssh [new file with mode: 0755]

diff --git a/ansible-ssh b/ansible-ssh
new file mode 100755 (executable)
index 0000000..9ccda46
--- /dev/null
@@ -0,0 +1,8 @@
+#! /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}"