fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Using SSH Config/Host aliases


From: Michael Gliwinski
Subject: Re: [Fab-user] Using SSH Config/Host aliases
Date: Thu, 16 Dec 2010 16:17:23 +0000
User-agent: KMail/1.13.5 (Linux/2.6.35-22-generic; KDE/4.5.3; x86_64; ; )

On Thursday 16 Dec 2010 15:09:06 Carlton Gibson wrote:
[...]
> 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
> 
[...]

You could use roledefs for that.  A role is a list of hosts but nothing stops 
you from having roles with just 1 host.

>         config = SSHConfig()
>         config.parse(config_file)
>         keys = [config.lookup(host).get('identityfile', None)
>             for host in env.hosts]
>         env.key_filename = [expanduser(key) for key in keys if key is not
> None] env.hosts = [hostinfo(host, config) for host in env.hosts]

Since hosts specifies which hosts the task is supposed to run on, I don't 
think this will do what you want (this would mean to run the tasks on all 
hosts in your config file if I'm reading it correctly).

But as mentioned above, if instead you populate env.roledefs like

env.roledefs[nick] = [host_str]

you could then use `fab -R nick ...` on command line.


-- 
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319

**********************************************************************************************
The information in this email is confidential and may be legally privileged.  
It is intended solely for the addressee and access to the email by anyone else 
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or 
any action taken or omitted to be taken in reliance on it, is prohibited and 
may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail 
are subject to the terms and conditions expressed  in the governing client 
engagement leter or contract.
If you have received this email in error please notify address@hidden

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, 
BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************




reply via email to

[Prev in Thread] Current Thread [Next in Thread]