FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

middleware:tftp:index.html



This is an old revision of the document!


Top#Middleware Management

TFTP (tftp.py)

Squid Operation

$ fab -l |grep tftp

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

Ref. Remote Shell Commands

$ 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, sed

FHHOME=os.environ["FHHOME"]

#----------------------------------------------------------------------
# Installing TFTP
#----------------------------------------------------------------------
# squid.install_tftp
@task
def install_tftp():
    '''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 \/var\/lib\/tftpboot/" /etc/xinetd.d/tftp)
    #sed -i "s/\(server_args[\t]*= *\).*/\1-s \/opt\/Tftproot -c/" /etc/xinetd.d/tft


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




Configuration



middleware/tftp/index.html.1517415156.txt.gz ยท Last modified: 2018/02/01 01:12 by kurihara