際際滷

際際滷Share a Scribd company logo
Introduction to Fabric
By
Suprith Gangawar
QE, RedHat
sgangawa@redhat.com
Deployment is Bothersome!
To be Covered
 What
 Why
 Pre-Requisites
 How  Demo
 Why not Others?
What is Fabric?
Fabric is a command line tool for streamlining the
use of SSH for application deployment or system
administration tasks
What
 Automation tool
 Written in python
 Lets you execute arbitrary python functions
 Library of sub routines
 Application deployment tool
Why?
 Cmake

Jam

Makeit
 Make
 Scons

Ant

Salt

Chef
 Puppet

And..
Fabric's Good Points
 Less codes than shell scripts
 Less mistakes than handwork
 Less time to operate many servers
Pre Requisites
 Python 2.5+
 Python-setuptools (optional but preferred)
 Pip
 easy_install (in case you dont use 'pip')
 gcc
Fabric's Basics
 Install
 $ pip install fabric
 Setting
 $ make fabfile.py
 Run
 $ fab <Option><Fab file>
Fabric API's
 Core API
 Sudo
 Run
 Color output functions
 Network
 Context Managers
 Contrib API
 User I/O
 Modifying remote files
 Django Integration
Core Functionality
 local() - Run commands locally
 Run() - Run command remotely
 Sudo() - Run a command remotely as another
user
 Put() - Copy a file from local to remote
 Get() - Copy a file from remote to local
Demo..
Why not others?
1. Ansible is not supported on windows
2. Ansible is for larger deployments unlike fabric
3. Salt does not deal with interactivity
4. Salt eats your logs giving you a very small
feedback (states/module outputs)
5. Puppet: Solid knowledge of Ruby is highly
recommended
6. Chef: Not 'complete' as compared to puppet
References
1. http://docs.fabfile.org/en/1.10/
2. https://pypi.python.org/pypi/Fabric
Stay Tuned..
 Official Twitter Account: @pyfabric
 IRC (Freenode): #fabric
 Mailing list
Thank you

More Related Content

Fabric presentation