0
我使用Python 2.6/Fabric 1.8.0,並且我有幾個主機包含不同的本地路徑和變量。如何針對結構中的主機列表運行任務
import
....
def vmm_two_a():
env.hosts = 'xxx.xx.xx.xx'
env.user = 'tom'
env.password = password_from_netrc(env.hosts,env.user)
global local_path
local_path = '/home/vmm_two_a/binaries'
def vmm_two_mgmt():
env.hosts = 'xxx.xx.xx.xx'
env.user = 'john'
env.password = password_from_netrc(env.hosts,env.user)
global local_path
local_path = '/home/vmm_two_mgmt/binaries'
def get_etc_binaries():
''' Get all etc binaries deployed '''
with hide('stderr','stdout','output','running', 'warnings'):
settings(warn_only=True)
get('/usr/local/etc', local_path)
如何針對所有主機運行此任務?我試過fab -H沒有成功。
感謝您的幫助