$FHHOME/fabfile/vsftpd.py
$ fab -l |grep -F vsftpd.
$ fab -H x.x.x.x vsftpd.xxxxx
$ H=test-serve-01,test-server-02 $ fab -H $H -- sudo diff /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.20171205 $ fab -H $H -- sudo mv /etc/vsftpd/vsftpd.conf.20171205 /etc/vsftpd/vsftpd.conf $ fab -H $H -- "ps aux |grep vsftpd" $ fab -H $H -- "lsof -i |grep ftp" $ fab -H $H -- sudo systemctl status vsftpd $ fab -H $H -- sudo systemctl restart vsftpd
$FHHOME/fabfile/vsftp.py
import sys, os from fabric.api import * from fabric.contrib import files FHHOME=os.environ["FHHOME"] #---------------------------------------------------------------------- # Installing vsftpd #---------------------------------------------------------------------- # vsftpd.install_rpm @task def install_rpm(): '''yum install vsftpd ''' sudo("rpm -q ftp > /dev/null 2>&1 || yum -y install ftp") sudo("rpm -q vsftpd > /dev/null 2>&1 || yum -y install vsftpd") #---------------------------------------------------------------------- # Configuration #---------------------------------------------------------------------- # tftp.conf @task def conf(): sudo("cp -p /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.`date -d '1day ago' +%Y%m%d`") #---------------------------------------------------------------------- # Service #----------------------------------------------------------------------