0
fabric
put
コマンドを使用して、ローカルファブリックシステムから複数のリモートホストにファイルをコピーしようとしています。ファイルをコピーしません。ローカルホストから複数のリモートホストにファイルをコピーするファブリック
第2に、私のリモートサーバーには既にファイルがありますが、それはここで問題になるかもしれませんか?コードの下に以下は
import sys
from fabric.api import env
from fabric.operations import run, put
env.skip_bad_hosts=True
env.command_timeout=160
env.user = 'jaggle'
env.shell = "/bin/sh -c"
env.warn_only = True
env.password = '[email protected]'
use_sudo = True
def readhost():
env.hosts = [line.strip() for line in sys.stdin.readlines()]
def copyLDAP():
put("/Karn/ldap.conf","/etc/ldap.conf", use_sudo = True)
代わりreadhost
タスクの、あなたが直接ホストのカンマ区切りのリストで-H
オプションを使用することができます
$ echo "tt-server01" | fab readhost -f OpenDgCopy.py copyLDAP
[tt-server0] Executing task 'copyLDAP'
[tt-server0] put: /Karn/ldap.conf -> /etc/ldap.conf
Done.
Disconnecting from tt-server0... done.