Changes between Initial Version and Version 1 of puppet/fabric


Ignore:
Timestamp:
Apr 28, 2011, 1:57:17 PM (14 years ago)
Author:
Jamie McClelland
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • puppet/fabric

    v1 v1  
     1[[PageOutline]]
     2= Fabric =
     3
     4[http://fabfile.org fabric] is a python framework for executing commands either locally or on a series of remote hosts.
     5
     6Our [wiki:puppet puppet repo] contains a fabric directory with a fabfile.py the defines commands to help with the management of our servers.
     7
     8== Why do we need fabric if we have puppet? ==
     9
     10Puppet allows us to easily ensure that a set of commands and files are executed and copied to our servers (and will execute/copy the commands/files over and over again if necessary).
     11
     12fabric allows us to execute/copy a command/file to one or more servers once and witness the output. Also, fabric allows us to perform operations locally, like list available servers or automate setting up a git remote for each server's puppet repository.
     13
     14== How do I install fabric? ==
     15
     16{{{
     17apt-get install fabric
     18}}}
     19
     20I've written our fabfile.py using fabric 0.9.1.
     21
     22== How do I use our fabric commands? ==
     23
     24First, cd into the fabric directory. All fabric commands must be executed from the fabric directory.
     25
     26Next, run the fab command followed by one or more sub-commands.
     27
     28For example:
     29
     30{{{
     31fab listServers
     32}}}
     33
     34Will generate a list of servers located in our manifests/nodes/production directory.
     35
     36You can limit the list by adding a colon separted argument to the command, by either specifying a specific server:
     37
     38{{{
     390 jamie@chicken:fabric$ fab listServers:mandela
     40mandela
     41
     42Done.
     430 jamie@chicken:fabric$
     44}}}
     45
     46Or, by specifying a phrase to grep all server manifests for:
     47
     48{{{
     490 jamie@chicken:fabric$ fab listServers:mosh
     50albizu
     51chavez
     52daza
     53debs
     54didier
     55eagle
     56ella
     57jones
     58julia
     59june
     60lucius
     61lucy
     62lumumba
     63malcolm
     64mandela
     65menchu
     66proudhon
     67rodolpho
     68roe
     69sojourner
     70viewsic
     71
     72Done.
     730 jamie@chicken:fabric$
     74}}}
     75
     76listServers is a local command, meaning it is executed on your computer.
     77
     78In addition, there are several available remote commands, which will execute on remote servers. When running a remote command, the hosts you want to execute on much be specified with the h command, using the same syntax as listServers. For example, the true command is a test command that simply executes /usr/bin/true on the remote server:
     79
     80{{{
     810 jamie@chicken:fabric$ fab h:mandela true
     82[root@mandela.mayfirst.org] run: true
     83
     84Done.
     85Disconnecting from root@mandela.mayfirst.org... done.
     860 jamie@chicken:fabric$
     87}}}
     88
     89== What other commands are available? ==
     90
     91Run:
     92
     93{{{
     94fab -l
     95}}}
     96
     97To see a list of all available commands.
     98
     99== How can I add new commands? ==
     100
     101Simply edit the fabfile.py and commit and push your changes.