pip安装fabric

六眼飞鱼酱① 提交于 2020-01-14 04:13:40

pip安装fabric

python2.7

$ wget https://github.com/fabric/fabric/archive/1.14.0.tar.gz

$ tar -xvf 1.14.0.tar.gz

$ cd fabric-1.14.0/

$ sudo pip install -e .

 

#python2.7

# _*_ coding:utf-8 _*_

from fabric.api import *

hosts1 = 'root@172.17.10.112'
# hosts2 = 'root@172.16.22.1'

env.hosts=[hosts1]
env.password='xxxxxx1234' #设置密码!

def hello():  #任务1
    run('echo hello world')

def check(): #任务2
    run('ls /Users/')

def remote(): #任务3
    run('ping www.baidu.com')

 

 

 mv py.py  fabfile.py

 

python2.7  /usr/bin/fab  -l 

 

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!