Created
October 1, 2012 11:40
-
-
Save anonymous/3811126 to your computer and use it in GitHub Desktop.
.ssh/config for ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bluszcz@rafal-dagens ~/repo/ansible $ git diff | |
diff --git a/lib/ansible/runner/connection_plugins/paramiko_ssh.py b/lib/ansible/runner/connection_plugins/paramiko_ssh.py | |
index b0f8c51..e9b0f2d 100644 | |
--- a/lib/ansible/runner/connection_plugins/paramiko_ssh.py | |
+++ b/lib/ansible/runner/connection_plugins/paramiko_ssh.py | |
@@ -29,6 +29,7 @@ with warnings.catch_warnings(): | |
warnings.simplefilter("ignore") | |
try: | |
import paramiko | |
+ from paramiko import SSHClient, SSHConfig | |
HAVE_PARAMIKO=True | |
except ImportError: | |
pass | |
@@ -55,6 +56,27 @@ class Connection(object): | |
vvv("ESTABLISH CONNECTION FOR USER: %s" % user, host=self.host) | |
+ | |
+ | |
+ ### BLUSZCZ MESS | |
+ config = SSHConfig() | |
+ home_directory = os.getenv('HOME') | |
+ config.parse(open(os.path.join(home_directory, '.ssh/config'))) | |
+ o = config.lookup(self.host) | |
+ #print o | |
+ | |
+ | |
+ if o.has_key('port'): | |
+ self.port = int(o['port']) | |
+ if o.has_key('hostname'): | |
+ self.host = o['hostname'] | |
+ if o.has_key('user'): | |
+ user = o['user'] | |
+ | |
+ | |
+ | |
+ #print "HOST",self.host, self.port, user | |
+ | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment