From 4c64d0d6beed29af94a821efc59f14a7d58901df Mon Sep 17 00:00:00 2001 From: Tim Gerla Date: Sun, 20 Jan 2013 13:16:01 -0800 Subject: [PATCH 1/3] Expand ~ shell shortcuts for the --private-key argument --- lib/ansible/runner/connection_plugins/paramiko_ssh.py | 2 +- lib/ansible/runner/connection_plugins/ssh.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/connection_plugins/paramiko_ssh.py b/lib/ansible/runner/connection_plugins/paramiko_ssh.py index c532e8fd5a..898c24bf06 100644 --- a/lib/ansible/runner/connection_plugins/paramiko_ssh.py +++ b/lib/ansible/runner/connection_plugins/paramiko_ssh.py @@ -82,7 +82,7 @@ class Connection(object): allow_agent = False try: ssh.connect(self.host, username=user, allow_agent=allow_agent, look_for_keys=True, - key_filename=self.runner.private_key_file, password=self.runner.remote_pass, + key_filename=os.path.expanduser(self.runner.private_key_file), password=self.runner.remote_pass, timeout=self.runner.timeout, port=self.port) except Exception, e: msg = str(e) diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index 66a7bcf504..ea9b03bad9 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -53,7 +53,7 @@ class Connection(object): if self.port is not None: self.common_args += ["-o", "Port=%d" % (self.port)] if self.runner.private_key_file is not None: - self.common_args += ["-o", "IdentityFile="+self.runner.private_key_file] + self.common_args += ["-o", "IdentityFile="+os.path.expanduser(self.runner.private_key_file)] if self.runner.remote_pass: self.common_args += ["-o", "GSSAPIAuthentication=no", "-o", "PubkeyAuthentication=no"] From b814f3dc66977df6b3b8280841b143cebcca5ea9 Mon Sep 17 00:00:00 2001 From: Tim Gerla Date: Sun, 20 Jan 2013 13:24:03 -0800 Subject: [PATCH 2/3] Correct --private-key argument name in Getting Started --- docsite/rst/gettingstarted.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docsite/rst/gettingstarted.rst b/docsite/rst/gettingstarted.rst index 2a33973ad2..88dbc52da0 100644 --- a/docsite/rst/gettingstarted.rst +++ b/docsite/rst/gettingstarted.rst @@ -197,7 +197,7 @@ Set up SSH agent to avoid retyping passwords: $ ssh-agent bash $ ssh-add ~/.ssh/id_rsa -(Depending on your setup, you may wish to ansible's --private-key-file option to specify a pem file instead) +(Depending on your setup, you may wish to ansible's --private-key option to specify a pem file instead) Now ping all your nodes: From 495c4e6cff380ba39ef3e4daea69f9ee9a2183e8 Mon Sep 17 00:00:00 2001 From: Tim Gerla Date: Sun, 20 Jan 2013 13:34:38 -0800 Subject: [PATCH 3/3] mention tilde fixes for --private-key in changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf57927fa7..4d97db17cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Ansible Changes By Release * SELinux fix for files created by authorized_key module * "template override" ?? * lots of documentation tweaks +* handle tilde shell character for --private-key * ...