ca5
7/9/2015 - 11:19 AM

fabric

fabric

# coding: utf-8
import logging,getpass,time,re
from fabric.api import run, cd, abort, require, sudo, env, parallel, local, execute
from fabric.decorators import runs_once, roles, hosts
from fabric.contrib.console import confirm

env.disable_known_hosts = True

def production():
    env.roledefs.update({
            'svr1': [#'svr1-01',
                    #'svr1-02',
                    ],
            'svr2': [#'svr2-01',
                    #'svr2-02',

                    ],
            })

@roles('svr1')
def do_cmd_api(cmd):
    run(cmd)

@roles('svr1')
def sudo_cmd_api(cmd):
    sudo(cmd)

@roles('svr2')
def do_cmd_tracking(cmd):
    run(cmd)

@roles('svr2')
def sudo_cmd_tracking(cmd):
    sudo(cmd)