FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


os:linux:pkg:index.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
os:linux:pkg:index.html [2018/01/04 00:47]
kurihara [Operation]
os:linux:pkg:index.html [2019/02/11 00:39] (current)
kurihara
Line 1: Line 1:
 [[:index.html#OS Management|Top#OS Management]] [[:index.html#OS Management|Top#OS Management]]
-====== Package Management (pkg.py) ======+====== Linux Package Management with Fabric (pkg.py) ======
  
 $FHHOME/fabfile/pkg.py $FHHOME/fabfile/pkg.py
Line 7: Line 7:
 \\ \\
  
-===== Operation =====+===== Operation with Fabric=====
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
 $ fab -l |grep pkg $ fab -l |grep pkg
  
-$ fab  -H $H auth.pro  pkg.check_cmd +$ fab  -H $H   pkg.check_cmd 
-$ fab  -H $H auth.pro  pkg.install_rpm_centos7+$ fab  -H $H   pkg.install_rpm_centos7
 </sxh> </sxh>
  
 +\\
 +==== Fabric one-line Task Examples ====
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
 $ H=test-server-01,test-server-02 $ H=test-server-01,test-server-02
-$ fab  -H $H auth.pro  -- "rpm -q xxxx" +$ fab -H $H   -- rpm -q xxxx 
-$ fab  -H $H auth.pro  -- "rpm -qa |grep xxx" +$ fab -H $H   -- "rpm -qa |grep xxx" 
-$ fab -H $H auth.pro --  "rpm -qa --last | head -20"+$ fab -H $H  --  "rpm -qa --last | head -20" 
 +</sxh> 
 + 
 +<sxh bash toolbar:false gutter:false> 
 +$ 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
 </sxh> </sxh>
  
Line 29: Line 41:
  
 <sxh python toolbar:false gutter:false> <sxh python toolbar:false gutter:false>
-import sys+import sys, os
 from fabric.api import * from fabric.api import *
 from fabric.contrib import files from fabric.contrib import files
  
 FHHOME=os.environ["FHHOME"] 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")
 +
  
 #=============================================================================== #===============================================================================
Line 39: Line 60:
 #=============================================================================== #===============================================================================
 #---------------------------------------------------------------------- #----------------------------------------------------------------------
-# CentOS7 RPM+# CentOS7
 #---------------------------------------------------------------------- #----------------------------------------------------------------------
 +#pkg.install_rpm_centos7
 @task @task
 def install_rpm_centos7(): def install_rpm_centos7():
-    put("%s/scripts/rpm.sh", "scripts/rpm.sh, mode=0755 % FHHOME)+    put("%s/scripts/rpm.sh" % FHHOME, "scripts/rpm.sh", mode=0755)
     sudo("scripts/rpm.sh centos7", pty=False)     sudo("scripts/rpm.sh centos7", pty=False)
  
 #---------------------------------------------------------------------- #----------------------------------------------------------------------
-#CentOS6 Common+#CentOS6
 #---------------------------------------------------------------------- #----------------------------------------------------------------------
 +#pkg.install_rpm_centos6
 +
 +
 +#----------------------------------------------------------------------
 +#Ubuntu16
 +#----------------------------------------------------------------------
 +#pkg.install_dpkg_ubuntu16
  
  
  
  
-#=============================================================================== 
-#Check Commands 
-#=============================================================================== 
-@task 
-def check_cmd(): 
-    put("%s/scripts/check_cmd.sh", "scripts/check_cmd.sh, mode=0755 % FHHOME) 
-    sudo("scripts/check_cmd.sh") 
  
 </sxh> </sxh>
Line 67: Line 89:
  
 |<100% 200px ->| |<100% 200px ->|
-| [[os:pkg:scripts:check_cmd.sh.html]]  |   | +| [[os:linux:pkg:scripts:check_cmd.sh.html]]  |   | 
-| [[os:pkg:scripts:rpm.sh.html]]        |   |+| [[os:linux:pkg:scripts:rpm.sh.html]]        |   |
  
  


os/linux/pkg/index.html.1514994479.txt.gz · Last modified: 2018/01/04 00:47 by kurihara