<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:schema="http://schema.org/" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" version="2.0" xml:base="https://www.linuxjournal.com/tag/fabric">
  <channel>
    <title>Fabric</title>
    <link>https://www.linuxjournal.com/tag/fabric</link>
    <description/>
    <language>en</language>
    
    <item>
  <title>Fabric: a System Administrator's Best Friend</title>
  <link>https://www.linuxjournal.com/content/fabric-system-administrators-best-friend</link>
  <description>  &lt;div data-history-node-id="1084451" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/keyboard_2.jpg" width="200" height="132" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/adrian-hannah" lang="" about="https://www.linuxjournal.com/users/adrian-hannah" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;Adrian Hannah&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
Do you routinely make changes to more than a dozen machines at a time?
Read this article to find out about a tool to make that task much easier.
&lt;/p&gt;
&lt;p&gt;
I'll be honest. Even though this library is fully five years old, I hadn't
heard of Fabric until about six months ago. Now I can't imagine not having
it in my digital tool belt. Fabric is a Python library/tool that is
designed to use SSH to execute system administration and deployment tasks
on one or more remote machines. No more running the same task, machine by
machine, to make one change across the board. It is a simple
fire-and-forget tool that will make your life so much simpler. Not only
can you run simple tasks via SSH on multiple machines, but since you're
using Python code to execute items, you can combine it with any arbitrary
Python code to make robust, complex, &lt;em&gt;elegant&lt;/em&gt; applications for deployment
or administration tasks.
&lt;/p&gt;

&lt;h3&gt;
Installation&lt;/h3&gt;

&lt;p&gt;
Fabric requires Python 2.5 or later, the setuptools packaging/installation
library, the ssh Python library, and SSH and its dependencies. For the
most part, you won't have to worry about any of this, because Fabric can
be installed easily through various package managers. The easiest, and
most prolific way to install Fabric is using pip (or easy_install). On
most systems, you can use your systems package manager (apt-get, install,
and so on) to install it (the package either will be fabric or python-fabric).
If you're feeling froggy, you can check out the git repository
and hack away at the source code.
&lt;/p&gt;

&lt;p&gt;
Once installed, you will have access to the &lt;code&gt;fab&lt;/code&gt; script from the command
line.
&lt;/p&gt;

&lt;h3&gt;
Operations&lt;/h3&gt;

&lt;p&gt;
The Fabric library is composed of nine separate operations that can be
used in conjunction to achieve your desired effect. Simply insert these
functions into your fabfile and off you go:
&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;
&lt;p&gt;
&lt;code&gt;get(remote_path, local_path=None)&lt;/code&gt; —
&lt;code&gt;get&lt;/code&gt; allows you to pull files from the remote machine to your local machine.
This is like using &lt;code&gt;rsync&lt;/code&gt; or
&lt;code&gt;scp&lt;/code&gt; to copy a file or files from many machines.
This is super effective for systematically collecting log files or backups
in a central location. The remote path is the path of the file on the
remote machine that you are grabbing, and the local path is the path to
which you
want to save the file on the local machine. If the local path is omitted,
Fabric assumes you are saving the file to the working directory.
&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;
&lt;code&gt;local(command, capture=False)&lt;/code&gt; — the local function allows you to take action on the local host in a similar
fashion to the Python subprocess module (in fact, local is a simplistic
wrapper that sits on top of the subprocess module). Simply supply the
command to run and, if needed, whether you want to capture the output. If
you specify &lt;code&gt;capture=True&lt;/code&gt;, the output will be returned as a string from
local, otherwise it will be output to STDOUT.
&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/fabric-system-administrators-best-friend" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Tue, 09 Apr 2013 19:09:40 +0000</pubDate>
    <dc:creator>Adrian Hannah</dc:creator>
    <guid isPermaLink="false">1084451 at https://www.linuxjournal.com</guid>
    </item>

  </channel>
</rss>
