FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

os:linux:example:index.html



Top#OS Management

Linux Fabric Examples

Operation

$ fab  -l |grep example.
$ fab -H host1,host2   ope.check_user01


Fabric one-line Task Examples

fab -H host1,host2  -- hostname
fab -H host1,host2  -- sudo cat /etc/shadow


example.py

$FHHOME/fabfile/example.py

import sys, os
from fabric.api import *
from fabric.contrib import files
from fabric.operations import open_shell

FHHOME=os.environ["FHHOME"]


@task
def change_group_user01():
  run("hostname")
  run("id user01")
  sudo("sed -i.20180304 's/^user01/dev/' /etc/group")
  run("diff /etc/group /etc/group.20180304")
  run("id user01")

@task
def change_group_user01_reverse():
  run("hostname")
  run("id user01")
  sudo("\cp -pf /etc/group.20180304 /etc/group" )
  run("id user01")


TIPS

color

from fabric.colors import *

def color():
    print 'aaaaa'
    print blue('blue') + ' color'
    print cyan('cyan') + ' color'
    print green('green') + ' color'
    print magenta('magenta') + ' color'
    print red('red') + ' color'
    print white('white') + ' color'
    print yellow('yellow') + ' color'
    print (red("This sentence is red, except for " +  green("these words, which are green") + "."))

tomcat start



os/linux/example/index.html.txt ยท Last modified: 2020/02/21 01:18 by kurihara