$FHHOME/fabfile/vind.py
$ fab -l |grep -F bind.
$ fab -H x.x.x.x bind.xxxxx
$ H=test-serve-01,test-server-02 $ fab -H $H -- "ps aux |grep named" $ fab -H $H -- "lsof -i |grep named" $ fab -H $H -- sudo systemctl status named $ fab -H $H -- sudo systemctl restart named $ fab -H $H -- sudo named-checkconf /etc/named.conf $ fab -H $H -- sudo rndc reload #Update All Zone Contents $ fab -H $H -- sudo rndc reconfig #add new zone file
$FHHOME/fabfile/bind.py
import sys, os
from fabric.api import *
from fabric.contrib import files
FHHOME=os.environ["FHHOME"]
#----------------------------------------------------------------------
# Installing bind
#----------------------------------------------------------------------
# vsftpd.install_rpm
@task
def install_rpm():
'''yum install vsftpd '''
sudo("rpm -q bind > /dev/null 2>&1 || yum -y install bind")
sudo("rpm -q bind-utils > /dev/null 2>&1 || yum -y install bind-utils")
#----------------------------------------------------------------------
# Configuration
#----------------------------------------------------------------------
# bind.conf
@task
def conf():
sudo("cp -p /etc/named.conf /etc/named.conf.`date -d '1day ago' +%Y%m%d`")
#----------------------------------------------------------------------
# Service
#----------------------------------------------------------------------