我使用pythonfabric在多个主机上并行执行命令。在
我有以下场景。在
def list1():
env.hosts=[H1,H2,H3]
def myfunction():
#login into H1 and execute a command and wait for certain string.
#once get the string login to H2 and H3 in parallel and execute some other command
现在我必须在H1上运行一个命令,当我从H1输出中得到一些想要的字符串时,我需要在H2和H3上运行其他命令。 都是linux机器。在
跑步
^{pr2}$像这样是不对的。我有什么办法可以做到这一点吗?在
谢谢
我不知道我是否明白你想要什么。我假设您希望在h1上运行一个任务,等待结果并将此结果用作h2和h3上的任务的输入。如果你想回答其他问题,请忘记回答
一种选择是创建一个执行fab任务的python脚本(而不是fab文件)。在
比如:
关键是execute方法。在
相关问题 更多 >
编程相关推荐