FastHandle - Automation Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Top     SiteMap

Sidebar


Top     SiteMap

Manager Server

Target Server













.

middleware:httpd:index.html



Top#Middleware Management

Apache httpd (httpd.py)

Apache httpd Operation

$ fab -l |grep httpd

$ fab  -H $H auth.pro  httpd.install_yum


Fabric Temporary Run Call Examples

$ H=test-server-1,test-server-2

$ fab  -H $H auth.pro  -- "ps aux |grep apahce"

$ fab  -H $H auth.pro  -- tree -Dpuga  /etc/httpd
$ fab  -H $H auth.pro  -- tree -Dpuga  /etc/apache2


httpd.py

$FHHOME/fabfile/httpd.py

import sys
from fabric.api import *
from fabric.contrib import files
 
#----------------------------------------------------------------------
# Installing Apache httpd
#----------------------------------------------------------------------
# httpd.install_yum
@task
def install_yum():
    sudo("rpm -q httpd        > /dev/null 2>&1 || yum -y install httpd")

# httpd.install_apt
@task
def install_apt():
    sudo("dpkg -l |grep apache    > /dev/null 2>&1 || apt install apahce2")



#----------------------------------------------------------------------
# Check Files
#----------------------------------------------------------------------
#RHEL/CentOS
# httpd.check_files_etc_httpd
@task
def check_files_etc_httpd():
    '''tree -Dpuga  /etc/httpd #centos'''
    run("tree -Dpuga  /etc/httpd")

#Debian/Ubuntu
# httpd.check_files_etc_apache2
@task
def check_files_etc_apache2():
    '''tree -Dpuga  /etc/apache2  #ubuntu'''
    run("tree -Dpuga  /etc/apache2")


#----------------------------------------------------------------------
# Check Modules
#----------------------------------------------------------------------
#RHEL/CentOS
@task
def check_modules_pkg():
    '''/usr/sbin/httpd -M  # Package'''
    run("/usr/sbin/httpd -M")

@task
def check_modules_src():
    '''/usr/local/apache2/bin/httpd -M  # SRC'''
    run("/usr/local/apache2/bin/httpd -M")


#----------------------------------------------------------------------
# Check Server-Status
#----------------------------------------------------------------------
@task
def check_server_satus():
    '''curl http://localhost/server-status?auto'''
    run("curl  http://localhost/server-status?auto")


#----------------------------------------------------------------------
# Check Header
#----------------------------------------------------------------------
@task
def check_header():
    '''curl -I http://localhost/'''
    run("curl -I http://localhost/")



Apache httpd Configuration Examples



middleware/httpd/index.html.txt ยท Last modified: 2018/02/21 23:50 by kurihara