如何使用 python 做自動化佈署 how to auto deploy python code


from fabric.api import *

# Automatically catch errors
env.warn_only = True

# Enable multi-process tasks
env.parallel = True

env.hosts = [
    'ubuntu@127.0.0.1',
    'ubuntu@127.0.0.2']

env.passwords = {
    'ubuntu@127.0.0.1:22': "password_1",
    'ubuntu@127.0.0.2:22': "password_1"
}


def test():
    sudo('mkdir /home/ubuntu/jojo')

def upload():
    put('local host path', 'remote host path')

def pip_commend():
    run("pip install modlue name.....")

沒有留言

技術提供:Blogger.