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













.

preparation:installing.html



Top#Preparation

Installing FastHandle

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 '
HISTIGNORE=pwd:history*:man
@

$ 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
$ 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/*


Method 2 : Make it yourself

You can install “From GitHub(Method 1)” or “Make it yourself(Method 2)”.

Reference Directory Structure

1. Make some directory

# su - fasthandle
$ cd /home/fasthandle
$ mkdir fhhome
$ cd fhhome
$ mkdir -p fhscripts fabfile hosts key scripts conf/os conf/httpd conf/named  bin src rpm deb log tmp output

3. Copy FastHandle Scripts

Please copy the necessary files and change permission like chmod 755 xxxx.sh.




Test FastHandle

$ 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 x.x.x.x auth.test test.local_hostname

$ fab -H x.x.x.x auth.test test.hostname




Configuring FastHandle



preparation/installing.html.txt · Last modified: 2018/02/04 01:00 by kurihara