env.host=['server1']
结果还是得输入主机名
改为如下:
env.host_string = 'server1' # ‘[email protected]’
这样就不用输入host 和password了。前提是ssh已经打通
----------------------------------------
env.roledefs = {
's1':['[email protected]',],
's2':['[email protected]',],
's3':['[email protected]',],
's4':['[email protected]',]
}
@roles('s1','s2','s3','s4')
def mkdir():
for i in range(250):
run('mkdir /data/remove/2015/'+ str(i))
这种也是可行的,只不过这样每个server都要执行一遍
----------------------------------------
python fabric env.host 不起作用
猜你喜欢
转载自jacklin2015.iteye.com/blog/2236218
今日推荐
周排行