$FHHOME/fabfile/pkg.py
$ fab -l |grep pkg $ fab -H $H pkg.check_cmd $ fab -H $H pkg.install_rpm_centos7
$ H=test-server-01,test-server-02 $ fab -H $H -- rpm -q xxxx $ fab -H $H -- "rpm -qa |grep xxx" $ fab -H $H -- "rpm -qa --last | head -20"
$ H=test-server-01,test-server-02 $ fab -H $H -- dpkg -l # check installed list $ fab -H $H -- apt search PACKAGE $ fab -H $H -- apt show PACKAGE $ fab -H $H -- apt update $ fab -H $H -- apt install -y PACKAGE
$FHHOME/fabfile/pkg.py
import sys, os from fabric.api import * from fabric.contrib import files FHHOME=os.environ["FHHOME"] #=============================================================================== #Check Commands #=============================================================================== @task def check_cmd(): put("%s/scripts/check_cmd.sh" % FHHOME, "scripts/check_cmd.sh", mode=0755) sudo("scripts/check_cmd.sh") #=============================================================================== # Installing Package #=============================================================================== #---------------------------------------------------------------------- # CentOS7 #---------------------------------------------------------------------- #pkg.install_rpm_centos7 @task def install_rpm_centos7(): put("%s/scripts/rpm.sh" % FHHOME, "scripts/rpm.sh", mode=0755) sudo("scripts/rpm.sh centos7", pty=False) #---------------------------------------------------------------------- #CentOS6 #---------------------------------------------------------------------- #pkg.install_rpm_centos6 #---------------------------------------------------------------------- #Ubuntu16 #---------------------------------------------------------------------- #pkg.install_dpkg_ubuntu16