#!/usr/bin/env python

from fabric.api import env,run,cd,put,local
import fabric.colors
import os

env.color_settings = {
    'abort': yellow,
    'error': yellow,
    'finish': cyan,
    'host_prefix': green,
    'prefix': red,
    'prompt': blue,
    'task': red,
    'warn': yellow
}

env.roledefs = {
    'adr_ct': ['172.16.31.10',
               '172.16.31.10',
               '192.168.3.11',
               '192.168.127.12',
               '192.168.127.12',
               '172.16.17.32',
               '192.168.127.12'],

    'ios_ct': ['192.168.3.11',
               '172.16.17.32',
               '192.168.127.12',
               '192.168.3.11',
               '192.168.3.11',
               '172.16.31.10', 
               '172.16.17.32',
               '172.16.58.3', 
               '192.168.3.11',
               '172.16.58.3',
               '192.168.3.11',
               '192.168.127.12',
               '172.16.17.32',
               '172.16.31.10',
               '172.16.58.3',
               '172.16.17.32']
}

env.config_file = 'deploy.yaml'
#env.hosts=open('hosts.txt','r').readlines()
env.user='lzadmin'
env.port='4399'
env.password=''

@roles('adr_ct')
@roles('ios_ct')
def init():
    local("echo pwd")
    filename=r''
    if os.path.exists(filename):
        task
    else:
        print "there is no file that you can putting"

def task():
    with cd('~/')
    put('./filename','./filename')



#!/usr/bin/env python

from fabric.api import env,run,cd,put,local
import fabric.colors
import os

env.color_settings = {
    'abort': yellow,
    'error': yellow,
    'finish': cyan,
    'host_prefix': green,
    'prefix': red,
    'prompt': blue,
    'task': red,
    'warn': yellow
}

env.roledefs = {
    'adr_ct': ['172.16.31.10',
               '172.16.31.10',
               '192.168.3.11',
               '192.168.127.12',
               '192.168.127.12',
               '172.16.17.32',
               '192.168.127.12'],

    'ios_ct': ['192.168.3.11',
               '172.16.17.32',
               '192.168.127.12',
               '192.168.3.11',
               '192.168.3.11',
               '172.16.31.10', 
               '172.16.17.32',
               '172.16.58.3', 
               '192.168.3.11',
               '172.16.58.3',
               '192.168.3.11',
               '192.168.127.12',
               '172.16.17.32',
               '172.16.31.10',
               '172.16.58.3',
               '172.16.17.32']
}

env.config_file = 'deploy.yaml'
#env.hosts=open('hosts.txt','r').readlines()
env.user='lzadmin'
env.port='4399'
env.password=''

@roles('adr_ct')
@roles('ios_ct')
def init():
    local("echo pwd")
    filename=r''
    if os.path.exists(filename):
        task
    else:
        print "there is no file that you can putting"

def task():
    with cd('~/')
    put('./filename','./filename')



#!/usr/bin/env python #env.hosts=open('hosts.txt','r').readlines()