FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Top     SiteMap

Sidebar


Top     SiteMap

Manager Server

Target Server

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













.

preparation:installing.html



Top#Preparation

Installing FastHandle in Manager Server

OS Preparation

Create fasthandle user

~]# useradd fasthandle
~]# echo 'fasthandle:fastpass' | chpasswd

fasthandle user Configuration

~]# su - fasthandle

~]$ cp -p ~/.bashrc ~/.bashrc.`date -d '1day ago' +%Y%m%d`
~]$ cat << @ >> ~/.bashrc

# HastHandle env
[ -f ~/fhhome/fh.env ] && source ~/fhhome/fh.env


# history
HISTSIZE=10000
HISTFILESIZE=10000
HISTTIMEFORMAT='%Y-%m-%dT%T%z '
@

~]$ cp -p ~/.ssh/config ~/.ssh/config.`date -d '1day ago' +%Y%m%d`
~]$ cat << @ >> ~/.ssh/config

# Don't listen yes/no.
host *
     # Ignore "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"
     StrictHostKeyChecking no
     UserKnownHostsFile=/dev/null

@
~]$ chmod 600 ~/.ssh/config


Prerequisites

  • Fabric
  • expect
  • tftp (if you need)
  • vsftpd ( if you need)


Fabric

Check Python Before Installing Fabric

Fabric requires Python version 2.5 - 2.7.

~]# python -V
Python 2.7.5

~]# python3 -V
Python 3.5.2

RHEL/CentOS ~]$ rpm -qa |grep python

Ubuntu ~]$ dpkg -l |grep  python


RHEL/CentOS with EPEL

~]# export http_proxy=http://xx.xx.xx:port/    <- if you need your proxy server.
~]# export https_proxy=http://xx.xx.xx.xx:port/    <- if you need your proxy server.

~]# yum install epel-release
~]# yum install fabric


RHEL/CentOS with pip

~]# yum install gcc python-devel python-setuptools
~]# easy_install pip
~]# pip install fabric


Debian/Ubuntu with apt

~]# apt install fabric


Debian/Ubuntu with pip

~]# apt-get install python-dev python-setuptools gcc
~]# easy_install pip
~]# pip install fabric


Debian/Ubuntu with pip , python3, virtualenv

~]$ virtualenv -p python3 env
~]$ source env/bin/activate
~]$ pip3 install fabric3


Expect

RHEL/CentOS

~]# export http_proxy=http://xx.xx.xx:port/    <- if you need your proxy server.
~]# export https_proxy=http://xx.xx.xx.xx:port/    <- if you need your proxy server.

~]# yum search expect
~]# yum install expect


Debian/Ubuntu

~]# apt search expect
~]# apt install expect




Installing FastHandle

Method 1 : From GitHub

~]$ cd /home/fasthandle
~]$ test -d fhhome && mv fhhome fhhome.`date +%Y%m%d`

~]$ git clone https://github.com/kuritaka/fasthandle.git  fhhome

~]$ tree -a -I '.git'  fhhome
~]$ chmod 755 fhhome/fhscripts/*


Method 2 : From GitHub

~]$ cd /home/fasthandle
~]$ git clone https://github.com/kuritaka/fasthandle.git  fhhome.`date +%Y%m%d`
~]$ tree -a -I '.git'  fhhome.`date +%Y%m%d`
~]$ mkdir fhhome
~]$ cp -pr fhhome.`date +%Y%m%d`/ fhhome/
~]$ chmod 755 fhhome/fhscripts/*




Test FastHandle

localhost test

~]$ fab -l
Available commands:

    auth.dev                                develop env
    auth.pro                                production env
    auth.stg                                staging env
    auth.test1
    auth.test2
    check.check_ssh_hostname                check_ssh_hostname:localuser,key,remoteuser,remotehost
    check.nmap                              fab auth.pro ope.nmap:22,x.x.x.x
    check.ntpsync
    check.ping_gw                           use  %s/scripts/check_ping_gw.sh
    check.reboot_check                      use  %s/scripts/check_reboot.sh
    check.reboot_diff
    .....

~]$ fab -H localhost test.local_hostname




remote host test

Configuring FastHandle

~]$ cd $FHHOME
~]$ vi auth.py

   # Configureing User and Password

~]$ fab -H 127.0.0.1 auth.test1 -- hostname
~]$ fab -H 127.0.0.1 auth.test1 test.hostname

~]$ fab -H x.x.x.x auth.test1 -- hostname
~]$ fab -H x.x.x.x auth.test1 test.hostname






Top#Preparation



preparation/installing.html.txt ยท Last modified: 2018/03/14 01:27 by kurihara