I'm having trouble with Fabric
not recognizing hosts that I have in .ssh/config
.
My fabfile.py
is as follows:
from fabric.api import *
env.hosts = ['lulu']
def whoami():
run('whoami')
Running $ fab whoami
gives:
[lulu] run: whoami
Fatal error: Name lookup failed for lulu
The name lulu
is in my ~/.ssh/config
, like this:
Host lulu
hostname 192.168.100.100
port 2100
IdentityFile ~/.ssh/lulu-key
My first thought to solving this is adding something like lulu.lulu
to /etc/hosts
(I'm on a Mac), but then I have to also pass in the identity file to Fabric - and I'd rather keep my authentication (i.e. ~/.ssh/config
) separate from my deployment (i.e. fabfile.py
).
As well, incidentally, if you try to connect to a host in the hosts file, fabric.contrib.projects.rsync_project
doesn't seem to acknowledge 'ports' in the hosts.env
(i.e. if you use hosts.env = [lulu:2100]
a call to rsync_project
seems to try connecting to lulu:21
).
Is there a reason Fabric doesn't recognize this lulu
name? I'd be much obliged for any input on how to resolve this.
Thank you for reading.
Brian