How to install and use fabric modules in Ubuntu 9.10

Source: Internet
Author: User
Tags ssh
How to install and use fabric in Ubuntu 9.10

From its website: "Fabric is a Python library and command-line tool that simplifies the use of SSH for application deployment or system management tasks." More specifically, the fabric is: A tool that allows you to execute arbitrary python functions from the command line; A subroutine library (above the lower level library) to execute shell commands easily and python via ssh.

Of course, most users combine these two things, using a cloth to write and execute Python functions or tasks, and automate interactions with remote servers. “

installation : Download package installation: sudo dpkg-i fabric*.deb

use :: Follow this brief tutorial to learn the basics. Create a file called fabfile.py please fill in your custom feature. For example:
From FABRIC.API import env, run, sudo
env.hosts = [' ubuntu1 ', ' ubuntu2 ', ' UBUNTU3 ']
Def upgrade_hosts ():
sudo (' apt-get update && apt-get dist-upgrade ')
Running Fabric: Fab upgrade_hosts

I think the fabric is very useful to save time and keep a similar server when you can design a task that will automatically run on all servers.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.