|
From: | Carlton Gibson |
Subject: | [Fab-user] Using SSH Config/Host aliases |
Date: | Thu, 16 Dec 2010 15:09:06 +0000 |
Hi All, I'm getting started with Fabric and am trying to work out how best to work with it in regards to my ssh config details. As is common, I have a ~/.ssh/config file with named blocks for Hostnames, Ports, Identity files and so on. In the first place I'd like to simply reference those named blocks in my fabfile and have it use those to determine the right details directly. I appreciate that this isn't currently supported but is (possibly) scheduled for the 1.0 or 1.1 release. In the meantime I've been experimenting with putative solutions that Google throws up (see below) and this brings me to my second (and main) desire/want. It's obviously not ideal but, I don't really mind duplicating the info in my ssh config file file while I wait for/lend a hand in getting Fabric to use it. What I do want to be able to do is specify rememberable/readable shortcut names for hosts in the fabfile and on the command line rather than opaque IP address & port number combinations. So, on the command line I'd like something like: $ fab -H my_site deploy and in @hosts decorators I'd like something like: @hosts('my_site') Even if the actual hostname is more like: address@hidden:1234 I've put the necessary details in a dictionary with the nicknames as keys, which gives simple @hosts usage (at the cost of some duplication) but it doesn't get me the command line case. I guess I'm wondering how people handle this currently, and if there is any work that I can perhaps lend an eye to for implementing a solution here? Below is just an example Google threw up parsing the ssh config file directly; however, it breaks the @hosts usage, which isn't ideal...
So I try this from the cli and it fails (as expected):
I'm not sure what the best solution is in the short run. Perhaps just hardcode the ugly details and live with the difficulties? Thanks for reading this far. Regards, Carlton |
[Prev in Thread] | Current Thread | [Next in Thread] |