fabric usage

原创
2014/09/03 11:20
阅读数 26
#! /usr/bin/env python
#coding=utf-8

from fabric.api import *
from fabric.state import *

env.roledefs = {
    'scan_proc_server': [
                         '162.16.1.105',
                         '162.16.1.141',
                         '162.16.1.142',
                         '162.16.1.143',
    ]
}

env.password = 'haha,youwill not known'

#env.roledefs = { 'web':['162.16.1.20'] }


@roles('scan_proc_server')
def task_scan_source():
    run('mkdir /dev/shm/chan/')
    put('./chan/', '/dev/shm/')
    with cd('/dev/shm/chan/'):
        run('python2.6 change_netmask.py')


@roles('scan_proc_server')
def task_web_source():
    # run('rm -rf /dev/shm/chan')
    run('rm -rf /dev/shm/chan')


def dotask():
    execute(task_pg_source)

totask()

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部