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

$FHHOME/fabfile/example.py


Operation

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


Fabric one-line Task Examples

fab -H host1,host2 auth.pro -- hostname
fab -H host1,host2 auth.pro -- 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")







Top#OS Management



os/linux/example/index.html.txt ยท Last modified: 2018/03/25 00:29 by kurihara