Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
fabrichttp://fabfile.org/
AboutFabric is a Python library and command-line  tool for streamlining the use of SSH for    application deployment or sy...
Features• Executing local or remote shell commands  (normally or via sudo)• Processing output• Uploading/downloading files•...
Executing commandsfabfile.py:from fabric.api import *env.hosts = [no1.troolee.com]def deploy():    with cd(cnc):        run...
Per-task argumentsdef foo(bar=‘foobar’, lorem=‘ipsum’):    passdef baz():    pass$ fab foo:Hello,lorem=World baz
env vs settingsfrom fabric.api import settings, run, envenv.hosts = [example.com]def exists(path):    with settings(warn_o...
Operations• get/put• local/run/sudo• open_shell• prompt/require• reboot
Context Managers • cd/lcd • path/prefix • settingswith prefix(workon myenv):    run(ls)    with prefix(source /some/script)...
Decorators• hosts/roles/with_settings• task• serial/parallel• with_settings• runs_once
Q&A
Thanks.
Upcoming SlideShare
Loading in …5
×

Donetsk.py - fabric

1,292 views

Published on

Published in: Technology, Design
  • Be the first to comment

  • Be the first to like this

Donetsk.py - fabric

  1. 1. fabrichttp://fabfile.org/
  2. 2. AboutFabric is a Python library and command-line tool for streamlining the use of SSH for application deployment or systems administration tasks.
  3. 3. Features• Executing local or remote shell commands (normally or via sudo)• Processing output• Uploading/downloading files• Prompting for input, aborting execution, etc• Multiple host, flexible configuration
  4. 4. Executing commandsfabfile.py:from fabric.api import *env.hosts = [no1.troolee.com]def deploy(): with cd(cnc): run(./update.sh)$ fab deploy$ fab -H system1,system2,system3 -- uname -a
  5. 5. Per-task argumentsdef foo(bar=‘foobar’, lorem=‘ipsum’): passdef baz(): pass$ fab foo:Hello,lorem=World baz
  6. 6. env vs settingsfrom fabric.api import settings, run, envenv.hosts = [example.com]def exists(path): with settings(warn_only=True): return run(test -e %s % path)$ fab exists:/home$ fab exists:/home,host=‘example.net’
  7. 7. Operations• get/put• local/run/sudo• open_shell• prompt/require• reboot
  8. 8. Context Managers • cd/lcd • path/prefix • settingswith prefix(workon myenv): run(ls) with prefix(source /some/script): run(touch a_file)$ workon myenv && ls$ workon myenv && source /some/script && touch a_file
  9. 9. Decorators• hosts/roles/with_settings• task• serial/parallel• with_settings• runs_once
  10. 10. Q&A
  11. 11. Thanks.

×