Recent Changes - Search:

Softwares

.

What-Is-Fabric


Fabric

Example:

Fabric is a Python (2.5-2.7) library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.

Fabric is best installed via pip (highly recommended) or easy_install (older, but still works fine), e.g.:

pip install fabric

Fabric scripts are basic Python files. They are run using the fab tool that is shipped with with Fabric. All this does is include (i.e. import ..) your script (i.e. instructions to perform) and execute the provided procedure.

What Fabric really brings to the table is its extensive and excellent integration with SSH that allows streamlining everything using simple scripts (i.e. fabfile.py).

Installing on Centos: Enable REPO use the below url:

http://www.itmission.org/Main/Additional-REPO-CentOS

Search python-pip & python-devel

[root@puppet ~]# yum info python-pip
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * epel: epel.mirror.net.in
 * rpmforge: kartolo.sby.datautama.net.id
 * sl: ftp2.scientificlinux.org
 * sl-security: ftp2.scientificlinux.org
 * sl6x: ftp2.scientificlinux.org
 * sl6x-security: ftp2.scientificlinux.org
Available Packages
Name        : python-pip
Arch        : noarch
Version     : 1.3.1
Release     : 4.el6
Size        : 330 k
Repo        : epel
Summary     : A tool for installing and managing Python packages
URL         : http://www.pip-installer.org
License     : MIT
Description : Pip is a replacement for `easy_install
            : <http://peak.telecommunity.com/DevCenter/EasyInstall>`_.  It uses mostly the
            : same techniques for finding packages, so packages that were made
            : easy_installable should be pip-installable as well.

[root@puppet ~]#

Installation:

[root@puppet ~]# yum -y install python-pip
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * epel: kartolo.sby.datautama.net.id
 * rpmforge: kartolo.sby.datautama.net.id
 * sl: ftp2.scientificlinux.org
 * sl-security: ftp2.scientificlinux.org
 * sl6x: ftp2.scientificlinux.org
 * sl6x-security: ftp2.scientificlinux.org
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-pip.noarch 0:1.3.1-4.el6 will be installed
--> Processing Dependency: python-setuptools for package: python-pip-1.3.1-4.el6.noarch
--> Running transaction check
---> Package python-setuptools.noarch 0:0.6.10-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================
 Package                             Arch                     Version                          Repository              Size
============================================================================================================================
Installing:
 python-pip                          noarch                   1.3.1-4.el6                      epel                   330 k
Installing for dependencies:
 python-setuptools                   noarch                   0.6.10-3.el6                     sl                     335 k

Transaction Summary
============================================================================================================================
Install       2 Package(s)

Total download size: 665 k
Installed size: 2.5 M
Downloading Packages:
(1/2): python-pip-1.3.1-4.el6.noarch.rpm                                                             | 330 kB     00:01
(2/2): python-setuptools-0.6.10-3.el6.noarch.rpm                                                     | 335 kB     00:03
----------------------------------------------------------------------------------------------------------------------------
Total                                                                                       103 kB/s | 665 kB     00:06
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) <epel@fedoraproject.org>
 Package: epel-release-6-8.noarch (installed)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : python-setuptools-0.6.10-3.el6.noarch                                                                    1/2
  Installing : python-pip-1.3.1-4.el6.noarch                                                                            2/2
  Verifying  : python-pip-1.3.1-4.el6.noarch                                                                            1/2
  Verifying  : python-setuptools-0.6.10-3.el6.noarch                                                                    2/2

Installed:
  python-pip.noarch 0:1.3.1-4.el6

Dependency Installed:
  python-setuptools.noarch 0:0.6.10-3.el6

Complete!
[root@puppet ~]#

Install Development Tools:

[root@puppet ~]# yum groupinstall "Development Tools"
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * epel: epel.mirror.net.in
 * rpmforge: kartolo.sby.datautama.net.id
 * sl: ftp2.scientificlinux.org
 * sl-security: ftp2.scientificlinux.org
 * sl6x: ftp2.scientificlinux.org
 * sl6x-security: ftp2.scientificlinux.org
Setting up Group Process
Checking for new repos for mirrors
epel/group_gz                                                                                        | 237 kB     00:00
sl/group_gz                                                                                          | 219 kB     00:03
sl6x/group_gz                                                                                        | 219 kB     00:03
Package 1:make-3.81-20.el6.x86_64 already installed and latest version
Package 1:pkgconfig-0.23-9.1.el6.x86_64 already installed and latest version
Package binutils-2.20.51.0.2-5.36.el6.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch 0:2.63-5.1.el6 will be installed
---> Package automake.noarch 0:1.11.1-4.el6 will be installed
---> Package bison.x86_64 0:2.4.1-5.el6 will be installed
---> Package byacc.x86_64 0:1.9.20070509-7.el6 will be installed
---> Package cscope.x86_64 0:15.6-6.el6 will be installed
---> Package ctags.x86_64 0:5.8-2.el6 will be installed
---> Package cvs.x86_64 0:1.11.23-16.el6 will be installed
---> Package diffstat.x86_64 0:1.51-2.el6 will be installed
---> Package doxygen.x86_64 1:1.6.1-6.el6 will be installed
---> Package elfutils.x86_64 0:0.152-1.el6 will be installed
--> Processing Dependency: elfutils-libs(x86-64) = 0.152-1.el6 for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.149)(64bit) for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.148)(64bit) for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.138)(64bit) for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.127)(64bit) for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.126)(64bit) for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libdw.so.1(ELFUTILS_0.122)(64bit) for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libasm.so.1(ELFUTILS_1.0)(64bit) for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libdw.so.1()(64bit) for package: elfutils-0.152-1.el6.x86_64
--> Processing Dependency: libasm.so.1()(64bit) for package: elfutils-0.152-1.el6.x86_64
---> Package flex.x86_64 0:2.5.35-8.el6 will be installed
---> Package gcc.x86_64 0:4.4.7-4.el6 will be installed
--> Processing Dependency: libgomp = 4.4.7-4.el6 for package: gcc-4.4.7-4.el6.x86_64
--> Processing Dependency: cpp = 4.4.7-4.el6 for package: gcc-4.4.7-4.el6.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.7-4.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-4.el6.x86_64
--> Processing Dependency: libgomp.so.1()(64bit) for package: gcc-4.4.7-4.el6.x86_64
---> Package gcc-c++.x86_64 0:4.4.7-4.el6 will be installed
--> Processing Dependency: libstdc++-devel = 4.4.7-4.el6 for package: gcc-c++-4.4.7-4.el6.x86_64
--> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-4.el6.x86_64
---> Package gcc-gfortran.x86_64 0:4.4.7-4.el6 will be installed
--> Processing Dependency: libgfortran = 4.4.7-4.el6 for package: gcc-gfortran-4.4.7-4.el6.x86_64
--> Processing Dependency: libgfortran.so.3()(64bit) for package: gcc-gfortran-4.4.7-4.el6.x86_64
---> Package gettext.x86_64 0:0.17-16.el6 will be installed
---> Package git.x86_64 0:1.7.1-3.el6_4.1 will be installed
--> Processing Dependency: perl-Git = 1.7.1-3.el6_4.1 for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: perl(Git) for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: perl(Error) for package: git-1.7.1-3.el6_4.1.x86_64
---> Package indent.x86_64 0:2.2.10-7.el6 will be installed
---> Package intltool.noarch 0:0.41.0-1.1.el6 will be installed
--> Processing Dependency: perl(XML::Parser) for package: intltool-0.41.0-1.1.el6.noarch
--> Processing Dependency: gettext-devel for package: intltool-0.41.0-1.1.el6.noarch
---> Package libtool.x86_64 0:2.2.6-15.5.el6 will be installed
---> Package patch.x86_64 0:2.6-6.el6 will be installed
---> Package patchutils.x86_64 0:0.3.1-3.1.el6 will be installed
---> Package rcs.x86_64 0:5.7-37.el6 will be installed
---> Package redhat-rpm-config.noarch 0:9.0.3-42.sl6 will be installed
---> Package rpm-build.x86_64 0:4.8.0-37.el6 will be installed
--> Processing Dependency: /usr/bin/gdb-add-index for package: rpm-build-4.8.0-37.el6.x86_64
---> Package subversion.x86_64 0:1.6.11-10.el6_5 will be installed
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion-1.6.11-10.el6_5.x86_64
--> Processing Dependency: apr >= 1.3.0 for package: subversion-1.6.11-10.el6_5.x86_64
--> Processing Dependency: libneon.so.27()(64bit) for package: subversion-1.6.11-10.el6_5.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: subversion-1.6.11-10.el6_5.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: subversion-1.6.11-10.el6_5.x86_64
---> Package swig.x86_64 0:1.3.40-6.el6 will be installed
---> Package systemtap.x86_64 0:2.3-3.el6 will be installed
--> Processing Dependency: systemtap-devel = 2.3-3.el6 for package: systemtap-2.3-3.el6.x86_64
--> Processing Dependency: systemtap-client = 2.3-3.el6 for package: systemtap-2.3-3.el6.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed
---> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-4.el6 will be installed
---> Package elfutils-libs.x86_64 0:0.152-1.el6 will be installed
---> Package gdb.x86_64 0:7.2-60.el6_4.1 will be installed
---> Package gettext-devel.x86_64 0:0.17-16.el6 will be installed
--> Processing Dependency: gettext-libs = 0.17-16.el6 for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgettextpo.so.0()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libgcj_bc.so.1()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
--> Processing Dependency: libasprintf.so.0()(64bit) for package: gettext-devel-0.17-16.el6.x86_64
---> Package glibc-devel.x86_64 0:2.12-1.132.el6_5.4 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.132.el6_5.4 for package: glibc-devel-2.12-1.132.el6_5.4.x86_64
--> Processing Dependency: glibc = 2.12-1.132.el6_5.4 for package: glibc-devel-2.12-1.132.el6_5.4.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.132.el6_5.4.x86_64
---> Package libgfortran.x86_64 0:4.4.7-4.el6 will be installed
---> Package libgomp.x86_64 0:4.4.7-4.el6 will be installed
---> Package libstdc++-devel.x86_64 0:4.4.7-4.el6 will be installed
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
---> Package neon.x86_64 0:0.29.3-3.el6_4 will be installed
--> Processing Dependency: libpakchois.so.0()(64bit) for package: neon-0.29.3-3.el6_4.x86_64
---> Package perl-Error.noarch 1:0.17015-4.el6 will be installed
---> Package perl-Git.noarch 0:1.7.1-3.el6_4.1 will be installed
---> Package perl-URI.noarch 0:1.40-2.el6 will be installed
---> Package perl-XML-Parser.x86_64 0:2.36-7.el6 will be installed
--> Processing Dependency: perl(LWP) for package: perl-XML-Parser-2.36-7.el6.x86_64
---> Package systemtap-client.x86_64 0:2.3-3.el6 will be installed
---> Package systemtap-devel.x86_64 0:2.3-3.el6 will be installed
--> Processing Dependency: kernel-devel for package: systemtap-devel-2.3-3.el6.x86_64
--> Running transaction check
---> Package gettext-libs.x86_64 0:0.17-16.el6 will be installed
---> Package glibc.x86_64 0:2.12-1.132.el6 will be updated
--> Processing Dependency: glibc = 2.12-1.132.el6 for package: glibc-common-2.12-1.132.el6.x86_64
---> Package glibc.x86_64 0:2.12-1.132.el6_5.4 will be an update
---> Package glibc-headers.x86_64 0:2.12-1.132.el6_5.4 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.132.el6_5.4.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.132.el6_5.4.x86_64
---> Package kernel-devel.x86_64 0:2.6.32-431.29.2.el6 will be installed
---> Package libgcj.x86_64 0:4.4.7-4.el6 will be installed
---> Package pakchois.x86_64 0:0.4-3.2.el6 will be installed
---> Package perl-libwww-perl.noarch 0:5.833-2.el6 will be installed
--> Processing Dependency: perl-HTML-Parser >= 3.33 for package: perl-libwww-perl-5.833-2.el6.noarch
--> Processing Dependency: perl(HTML::Entities) for package: perl-libwww-perl-5.833-2.el6.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-libwww-perl-5.833-2.el6.noarch
--> Processing Dependency: mailcap for package: perl-libwww-perl-5.833-2.el6.noarch
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Running transaction check
---> Package glibc-common.x86_64 0:2.12-1.132.el6 will be updated
---> Package glibc-common.x86_64 0:2.12-1.132.el6_5.4 will be an update
---> Package kernel-headers.x86_64 0:2.6.32-431.29.2.el6 will be installed
---> Package mailcap.noarch 0:2.1.31-2.el6 will be installed
---> Package perl-Compress-Zlib.x86_64 0:2.021-136.el6 will be installed
--> Processing Dependency: perl(IO::Uncompress::Gunzip) >= 2.021 for package: perl-Compress-Zlib-2.021-136.el6.x86_64
--> Processing Dependency: perl(IO::Compress::Gzip::Constants) >= 2.021 for package: perl-Compress-Zlib-2.021-136.el6.x86_64
--> Processing Dependency: perl(IO::Compress::Gzip) >= 2.021 for package: perl-Compress-Zlib-2.021-136.el6.x86_64
--> Processing Dependency: perl(IO::Compress::Base::Common) >= 2.021 for package: perl-Compress-Zlib-2.021-136.el6.x86_64
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.021 for package: perl-Compress-Zlib-2.021-136.el6.x86_64
---> Package perl-HTML-Parser.x86_64 0:3.64-2.el6 will be installed
--> Processing Dependency: perl(HTML::Tagset) >= 3.03 for package: perl-HTML-Parser-3.64-2.el6.x86_64
--> Processing Dependency: perl(HTML::Tagset) for package: perl-HTML-Parser-3.64-2.el6.x86_64
--> Running transaction check
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.021-136.el6 will be installed
---> Package perl-HTML-Tagset.noarch 0:3.20-4.el6 will be installed
---> Package perl-IO-Compress-Base.x86_64 0:2.021-136.el6 will be installed
---> Package perl-IO-Compress-Zlib.x86_64 0:2.021-136.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================
 Package                             Arch                Version                             Repository                Size
============================================================================================================================
Installing:
 autoconf                            noarch              2.63-5.1.el6                        sl                       780 k
 automake                            noarch              1.11.1-4.el6                        sl                       549 k
 bison                               x86_64              2.4.1-5.el6                         sl                       635 k
 byacc                               x86_64              1.9.20070509-7.el6                  sl                        47 k
 cscope                              x86_64              15.6-6.el6                          sl                       135 k
 ctags                               x86_64              5.8-2.el6                           sl                       146 k
 cvs                                 x86_64              1.11.23-16.el6                      sl                       711 k
 diffstat                            x86_64              1.51-2.el6                          sl                        28 k
 doxygen                             x86_64              1:1.6.1-6.el6                       sl                       2.4 M
 elfutils                            x86_64              0.152-1.el6                         sl                       200 k
 flex                                x86_64              2.5.35-8.el6                        sl                       285 k
 gcc                                 x86_64              4.4.7-4.el6                         sl                        10 M
 gcc-c++                             x86_64              4.4.7-4.el6                         sl                       4.7 M
 gcc-gfortran                        x86_64              4.4.7-4.el6                         sl                       4.7 M
 gettext                             x86_64              0.17-16.el6                         sl                       1.8 M
 git                                 x86_64              1.7.1-3.el6_4.1                     sl                       4.6 M
 indent                              x86_64              2.2.10-7.el6                        sl                       114 k
 intltool                            noarch              0.41.0-1.1.el6                      sl                        57 k
 libtool                             x86_64              2.2.6-15.5.el6                      sl                       563 k
 patch                               x86_64              2.6-6.el6                           sl                        90 k
 patchutils                          x86_64              0.3.1-3.1.el6                       sl                        94 k
 rcs                                 x86_64              5.7-37.el6                          sl                       172 k
 redhat-rpm-config                   noarch              9.0.3-42.sl6                        sl                        58 k
 rpm-build                           x86_64              4.8.0-37.el6                        sl                       126 k
 subversion                          x86_64              1.6.11-10.el6_5                     sl-security              2.3 M
 swig                                x86_64              1.3.40-6.el6                        sl                       1.1 M
 systemtap                           x86_64              2.3-3.el6                           sl                        25 k
Installing for dependencies:
 apr                                 x86_64              1.3.9-5.el6_2                       sl                       122 k
 apr-util                            x86_64              1.3.9-3.el6_0.1                     sl                        86 k
 cloog-ppl                           x86_64              0.15.7-1.2.el6                      sl                        92 k
 cpp                                 x86_64              4.4.7-4.el6                         sl                       3.7 M
 elfutils-libs                       x86_64              0.152-1.el6                         sl                       180 k
 gdb                                 x86_64              7.2-60.el6_4.1                      sl                       2.3 M
 gettext-devel                       x86_64              0.17-16.el6                         sl                       154 k
 gettext-libs                        x86_64              0.17-16.el6                         sl                       111 k
 glibc-devel                         x86_64              2.12-1.132.el6_5.4                  sl-security              979 k
 glibc-headers                       x86_64              2.12-1.132.el6_5.4                  sl-security              608 k
 kernel-devel                        x86_64              2.6.32-431.29.2.el6                 sl-security              8.8 M
 kernel-headers                      x86_64              2.6.32-431.29.2.el6                 sl-security              2.9 M
 libgcj                              x86_64              4.4.7-4.el6                         sl                        18 M
 libgfortran                         x86_64              4.4.7-4.el6                         sl                       265 k
 libgomp                             x86_64              4.4.7-4.el6                         sl                       117 k
 libstdc++-devel                     x86_64              4.4.7-4.el6                         sl                       1.6 M
 mailcap                             noarch              2.1.31-2.el6                        sl                        26 k
 mpfr                                x86_64              2.4.1-6.el6                         sl                       156 k
 neon                                x86_64              0.29.3-3.el6_4                      sl                       118 k
 pakchois                            x86_64              0.4-3.2.el6                         sl                        20 k
 perl-Compress-Raw-Zlib              x86_64              1:2.021-136.el6                     sl                        68 k
 perl-Compress-Zlib                  x86_64              2.021-136.el6                       sl                        44 k
 perl-Error                          noarch              1:0.17015-4.el6                     sl                        28 k
 perl-Git                            noarch              1.7.1-3.el6_4.1                     sl                        27 k
 perl-HTML-Parser                    x86_64              3.64-2.el6                          sl                       108 k
 perl-HTML-Tagset                    noarch              3.20-4.el6                          sl                        15 k
 perl-IO-Compress-Base               x86_64              2.021-136.el6                       sl                        68 k
 perl-IO-Compress-Zlib               x86_64              2.021-136.el6                       sl                       134 k
 perl-URI                            noarch              1.40-2.el6                          sl                       116 k
 perl-XML-Parser                     x86_64              2.36-7.el6                          sl                       223 k
 perl-libwww-perl                    noarch              5.833-2.el6                         sl                       386 k
 ppl                                 x86_64              0.10.2-11.el6                       sl                       1.3 M
 systemtap-client                    x86_64              2.3-3.el6                           sl                       3.4 M
 systemtap-devel                     x86_64              2.3-3.el6                           sl                       1.4 M
Updating for dependencies:
 glibc                               x86_64              2.12-1.132.el6_5.4                  sl-security              3.8 M
 glibc-common                        x86_64              2.12-1.132.el6_5.4                  sl-security               14 M

Transaction Summary
============================================================================================================================
Install      61 Package(s)
Upgrade       2 Package(s)

Total size: 102 M
Total download size: 84 M
Is this ok [y/N]:

Install pycrypto-on-pypi

Successfully installed pycrypto-on-pypi
Cleaning up...
You have new mail in /var/spool/mail/root
[root@puppet ~]# pip install pycrypto-on-pypi

Checking if pycrypto-on-pypi is available.

[root@puppet ~]# pip install pycrypto-on-pypi
Requirement already satisfied (use --upgrade to upgrade): pycrypto-on-pypi in /usr/lib64/python2.6/site-packages
Cleaning up...
[root@puppet ~]#

Installing Fabric


[root@puppet ~]# pip install fabric
Requirement already satisfied (use --upgrade to upgrade): fabric in /usr/lib/python2.6/site-packages
Requirement already satisfied (use --upgrade to upgrade): paramiko>=1.10 in /usr/lib/python2.6/site-packages (from fabric)
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.1,!=2.4 in /usr/lib64/python2.6/site-packages (from paramiko>=1.10->fabric)
Requirement already satisfied (use --upgrade to upgrade): ecdsa>=0.11 in /usr/lib/python2.6/site-packages (from paramiko>=1.10->fabric)
Cleaning up...
[root@puppet ~]#

Simple Fab File example:

http://docs.fabfile.org/en/1.4.2/usage/fabfiles.html#fabfile-discovery


[root@puppet ~]# cat fabfile.py
from fabric.api import run
def host_type():
    run('uname -s')
[root@puppet ~]# fab -f fabfile.py -H localhost host_type
[localhost] Executing task 'host_type'
[localhost] run: uname -s
[localhost] Login password for 'root':
[localhost] out: Linux
[localhost] out:


Done.
Disconnecting from localhost... done.
[root@puppet ~]# fab -H localhost host_type
[localhost] Executing task 'host_type'
[localhost] run: uname -s
[localhost] Login password for 'root':
[localhost] out: Linux
[localhost] out:


Done.
Disconnecting from localhost... done.
[root@puppet ~]# fab -H localhost,agent  host_type
[localhost] Executing task 'host_type'
[localhost] run: uname -s
[localhost] Login password for 'root':
[localhost] out: Linux
[localhost] out:

[agent] Executing task 'host_type'
[agent] run: uname -s

Fatal error: Low level socket error connecting to host agent on port 22: No route to host (tried 1 time)

Underlying exception:
    No route to host

Aborting.
Disconnecting from localhost... done.

[root@puppet ~]# fab --list
Available commands:

    host_type
[root@puppet ~]#

Example of collecting disk usage from each server:


[root@puppet ~]# fab -H localhost,agent host_type
[localhost] Executing task 'host_type'
[localhost] run: df -h
[localhost] Login password for 'root':
[localhost] out: Filesystem                     Size  Used Avail Use% Mounted on
[localhost] out: /dev/mapper/vg_livecd-lv_root  6.7G  2.4G  4.2G  37% /
[localhost] out: tmpfs                          739M     0  739M   0% /dev/shm
[localhost] out: /dev/sda1                      485M   45M  416M  10% /boot
[localhost] out:

[agent] Executing task 'host_type'
[agent] run: df -h
[agent] out: Filesystem                     Size  Used Avail Use% Mounted on
[agent] out: /dev/mapper/vg_livecd-lv_root  6.7G  2.0G  4.7G  30% /
[agent] out: tmpfs                          739M     0  739M   0% /dev/shm
[agent] out: /dev/sda1                      485M   45M  416M  10% /boot
[agent] out:


Done.
Disconnecting from agent... done.
Disconnecting from localhost... done.

[root@puppet ~]# cat fabfile.py
from fabric.api import *
def host_type():
    run('df -h')
[root@puppet ~]#

RPM install Example:

[root@puppet ~]# fab -H localhost,agent host_type
[localhost] Executing task 'host_type'
[localhost] run: rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
[localhost] Login password for 'root':
[localhost] out: Retrieving http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
[localhost] out: warning: /var/tmp/rpm-tmp.3k3LBh: Header V4 RSA/SHA1 Signature, key ID 4bd6ec30: NOKEY
[localhost] out: Preparing...                ########################################### [100%]
[localhost] out:    1:puppetlabs-release     ########################################### [100%]
[localhost] out:

[agent] Executing task 'host_type'
[agent] run: rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
[agent] out: Retrieving http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
[agent] out: warning: /var/tmp/rpm-tmp.wEppZN: Header V4 RSA/SHA1 Signature, key ID 4bd6ec30: NOKEY
[agent] out: Preparing...                ########################################### [100%]
[agent] out:    1:puppetlabs-release     ########################################### [100%]
[agent] out:


Done.
Disconnecting from agent... done.
Disconnecting from localhost... done.

Usage: fab [options] <command>[:arg1,arg2=val2,host=foo,hosts='h1;h2',...] ...

[root@puppet ~]# fab
Usage: fab [options] <command>[:arg1,arg2=val2,host=foo,hosts='h1;h2',...] ...

Options:
  -h, --help            show this help message and exit
  -d NAME, --display=NAME
                        print detailed info about command NAME
  -F FORMAT, --list-format=FORMAT
                        formats --list, choices: short, normal, nested
  -I, --initial-password-prompt
                        Force password prompt up-front
  -l, --list            print list of possible commands and exit
  --set=KEY=VALUE,...   comma separated KEY=VALUE pairs to set Fab env vars
  --shortlist           alias for -F short --list
  -V, --version         show program's version number and exit
  -a, --no_agent        don't use the running SSH agent
  -A, --forward-agent   forward local agent to remote end
  --abort-on-prompts    abort instead of prompting (for password, host, etc)
  -c PATH, --config=PATH
                        specify location of config file to use
  --colorize-errors     Color error output
  -D, --disable-known-hosts
                        do not load user known_hosts file
  -e, --eagerly-disconnect
                        disconnect from hosts as soon as possible
  -f PATH, --fabfile=PATH
                        python module file to import, e.g. '../other.py'
  -g HOST, --gateway=HOST
                        gateway host to connect through
  --hide=LEVELS         comma-separated list of output levels to hide
  -H HOSTS, --hosts=HOSTS
                        comma-separated list of hosts to operate on
  -i PATH               path to SSH private key file. May be repeated.
  -k, --no-keys         don't load private key files from ~/.ssh/
  --keepalive=N         enables a keepalive every N seconds
  --linewise            print line-by-line instead of byte-by-byte
  -n M, --connection-attempts=M
                        make M attempts to connect before giving up
  --no-pty              do not use pseudo-terminal in run/sudo
  -p PASSWORD, --password=PASSWORD
                        password for use with authentication and/or sudo
  -P, --parallel        default to parallel execution method
  --port=PORT           SSH connection port
  -r, --reject-unknown-hosts
                        reject unknown hosts
  --system-known-hosts=SYSTEM_KNOWN_HOSTS
                        load system known_hosts file before reading user
                        known_hosts
  -R ROLES, --roles=ROLES
                        comma-separated list of roles to operate on
  -s SHELL, --shell=SHELL
                        specify a new shell, defaults to '/bin/bash -l -c'
  --show=LEVELS         comma-separated list of output levels to show
  --skip-bad-hosts      skip over hosts that can't be reached
  --skip-unknown-tasks  skip over unknown tasks
  --ssh-config-path=PATH
                        Path to SSH config file
  -t N, --timeout=N     set connection timeout to N seconds
  -T N, --command-timeout=N
                        set remote command timeout to N seconds
  -u USER, --user=USER  username to use when connecting to remote hosts
  -w, --warn-only       warn, instead of abort, when commands fail
  -x HOSTS, --exclude-hosts=HOSTS
                        comma-separated list of hosts to exclude
  -z INT, --pool-size=INT
                        number of concurrent processes to use in parallel mode
[root@puppet ~]#

Edit - History - Print - Recent Changes - Search
Page last modified on October 14, 2014, at 09:12 PM