FastHandle - Automation Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Top     SiteMap

Sidebar


Top     SiteMap

Manager Server

Target Server













.

middleware:tftp:index.html



Top#Middleware Management

TFTP (tftp.py)

$FHHOME/fabfile/tftp.py


TFTP Operation

$ fab -l |grep tftp

$ fab  -H x.x.x.x auth.pro  tftp.xxxxx


Fabric Temporary Run Call Examples

$ H=test-serve-01,test-server-02

$ fab -H $H auth.pro -- sudo diff /etc/squid/squid.conf /etc/squid/squid.conf.20171205
$ fab -H $H auth.pro -- sudo mv /etc/squid/squid.conf.20171205 /etc/squid/squid.conf

$ fab -H $H auth.pro -- "ps aux |grep suqid"
$ fab -H $H auth.pro -- sudo systemctl status squid
$ fab -H $H auth.pro -- sudo systemctl restart squid


tftp.py

$FHHOME/fabfile/tftp.py

import sys, os
from fabric.api import *
from fabric.contrib import files

FHHOME=os.environ["FHHOME"]

#----------------------------------------------------------------------
# Installing TFTP
#----------------------------------------------------------------------
# squid.install_tftp
@task
def install_rpm():
    '''yum install tftp tftp-server xinetd '''
    sudo("rpm -q tftp         > /dev/null 2>&1 || yum -y install tftp")
    sudo("rpm -q tftp-server  > /dev/null 2>&1 || yum -y install tftp-server")
    sudo("rpm -q xinetd       > /dev/null 2>&1 || yum -y install xinetd")

#----------------------------------------------------------------------
# Configuration
#----------------------------------------------------------------------
# tftp.conf
@task
def conf():
    sudo("cp -p /etc/xinetd.d/tftp ~/tftp.`date -d '1day ago' +%Y%m%d`")

    #disable                 = no
    sudo("sed -i '/disable/ s/yes/no/' /etc/xinetd.d/tftp")
    #sed -i "s/\(disable[\t]*= *\).*/\1no/" /etc/xinetd.d/tftp

    #server_args             = -c -u root -s /var/lib/tftpboot
    sudo('sed -i "s/\(server_args[\t]*= *\).*/\1-c -u root -s \/home\/fasthandle\/fhhome\/tftp/" /etc/xinetd.d/tftp')
    #sed -i "s/\(server_args[\t]*= *\).*/\1-s \/opt\/Tftproot -c/" /etc/xinetd.d/tft

    sudo("test -d /home/fasthandle/fhhome/tftp || mkdir /home/fasthandle/fhhome/tftp")
    sudo("chmod 777 /home/fasthandle/fhhome/tftp")

#----------------------------------------------------------------------
# Service
#----------------------------------------------------------------------






Top#Middleware Management



middleware/tftp/index.html.txt ยท Last modified: 2018/02/21 23:51 by kurihara