SlideShare une entreprise Scribd logo
1  sur  11
fabric
http://fabfile.org/
About

Fabric is a Python library and command-line
  tool for streamlining the use of SSH for
    application deployment or systems
             administration tasks.
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
Executing commands
fabfile.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
Per-task arguments
def foo(bar=‘foobar’, lorem=‘ipsum’):
    pass

def baz():
    pass



$ fab foo:Hello,lorem=World baz
env vs settings
from fabric.api import settings, run, env

env.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’
Operations

• get/put
• local/run/sudo
• open_shell
• prompt/require
• reboot
Context Managers
 • cd/lcd
 • path/prefix
 • settings
with 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
Decorators

• hosts/roles/with_settings
• task
• serial/parallel
• with_settings
• runs_once
Q&A
Thanks.

Contenu connexe

Tendances

wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launched
Mat Schaffer
 
Fabric
FabricFabric
Fabric
JS Lee
 

Tendances (20)

Troubleshooting Puppet
Troubleshooting PuppetTroubleshooting Puppet
Troubleshooting Puppet
 
How to simplify OSGi development using OBR - Peter Kriens
How to simplify OSGi development using OBR - Peter KriensHow to simplify OSGi development using OBR - Peter Kriens
How to simplify OSGi development using OBR - Peter Kriens
 
Software Exploitation Techniques by Amit Malik
Software Exploitation Techniques by Amit MalikSoftware Exploitation Techniques by Amit Malik
Software Exploitation Techniques by Amit Malik
 
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
ReUse Your (Puppet) Modules!
ReUse Your (Puppet) Modules!ReUse Your (Puppet) Modules!
ReUse Your (Puppet) Modules!
 
Node.js
Node.jsNode.js
Node.js
 
wwc start-launched
wwc start-launchedwwc start-launched
wwc start-launched
 
PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)
 
Capistrano, Puppet, and Chef
Capistrano, Puppet, and ChefCapistrano, Puppet, and Chef
Capistrano, Puppet, and Chef
 
Introduction to Resque
Introduction to ResqueIntroduction to Resque
Introduction to Resque
 
Perl one-liners
Perl one-linersPerl one-liners
Perl one-liners
 
Fabric
FabricFabric
Fabric
 
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
 
Ansible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy MykhailiutaAnsible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy Mykhailiuta
 
An introduction to Rex - FLOSS UK DevOps York 2015
An introduction to Rex - FLOSS UK DevOps York 2015An introduction to Rex - FLOSS UK DevOps York 2015
An introduction to Rex - FLOSS UK DevOps York 2015
 
Perl Dancer, FPW 2010
Perl Dancer, FPW 2010Perl Dancer, FPW 2010
Perl Dancer, FPW 2010
 
Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9
 
Writing webapps with Perl Dancer
Writing webapps with Perl DancerWriting webapps with Perl Dancer
Writing webapps with Perl Dancer
 
Go-Couchbase Golang Paris 2015/12/17
Go-Couchbase Golang Paris 2015/12/17Go-Couchbase Golang Paris 2015/12/17
Go-Couchbase Golang Paris 2015/12/17
 

En vedette

Fabric-让部署变得简单
Fabric-让部署变得简单Fabric-让部署变得简单
Fabric-让部署变得简单
Eric Lo
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
andymccurdy
 
Magnani & Agazzi's Comparison of Philosophy of Science
Magnani & Agazzi's Comparison of Philosophy of ScienceMagnani & Agazzi's Comparison of Philosophy of Science
Magnani & Agazzi's Comparison of Philosophy of Science
Jillian May Peralta
 
Статья журнал Фотоника - Аддитивные технологии Часть 1. - Металл
Статья журнал Фотоника - Аддитивные технологии Часть 1. - МеталлСтатья журнал Фотоника - Аддитивные технологии Часть 1. - Металл
Статья журнал Фотоника - Аддитивные технологии Часть 1. - Металл
Maxim Makarov
 

En vedette (20)

2056
20562056
2056
 
Django with Mongo using Mongoengine
Django with Mongo using MongoengineDjango with Mongo using Mongoengine
Django with Mongo using Mongoengine
 
Fabric
FabricFabric
Fabric
 
Fabric (python)
Fabric (python)Fabric (python)
Fabric (python)
 
Fabric-让部署变得简单
Fabric-让部署变得简单Fabric-让部署变得简单
Fabric-让部署变得简单
 
fabfile.py
fabfile.pyfabfile.py
fabfile.py
 
Automation - fabric, django and more
Automation - fabric, django and moreAutomation - fabric, django and more
Automation - fabric, django and more
 
Fabric - a server management tool from Instagram
Fabric - a server management tool from InstagramFabric - a server management tool from Instagram
Fabric - a server management tool from Instagram
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Scaling mysql with python (and Docker).
Scaling mysql with python (and Docker).Scaling mysql with python (and Docker).
Scaling mysql with python (and Docker).
 
Fabric
FabricFabric
Fabric
 
Fabric, Cuisine and Watchdog for server administration in Python
Fabric, Cuisine and Watchdog for server administration in PythonFabric, Cuisine and Watchdog for server administration in Python
Fabric, Cuisine and Watchdog for server administration in Python
 
Lab 1 my sql tutorial
Lab 1 my sql tutorial Lab 1 my sql tutorial
Lab 1 my sql tutorial
 
Annuity and Life Insurance Product Update - Q2 2016
Annuity and Life Insurance Product Update - Q2 2016Annuity and Life Insurance Product Update - Q2 2016
Annuity and Life Insurance Product Update - Q2 2016
 
Magnani & Agazzi's Comparison of Philosophy of Science
Magnani & Agazzi's Comparison of Philosophy of ScienceMagnani & Agazzi's Comparison of Philosophy of Science
Magnani & Agazzi's Comparison of Philosophy of Science
 
Новости недвижимости Майами за август 2016
Новости недвижимости Майами за август 2016 Новости недвижимости Майами за август 2016
Новости недвижимости Майами за август 2016
 
Jow Without Images Maltz
Jow Without Images MaltzJow Without Images Maltz
Jow Without Images Maltz
 
Parambariyam
ParambariyamParambariyam
Parambariyam
 
Статья журнал Фотоника - Аддитивные технологии Часть 1. - Металл
Статья журнал Фотоника - Аддитивные технологии Часть 1. - МеталлСтатья журнал Фотоника - Аддитивные технологии Часть 1. - Металл
Статья журнал Фотоника - Аддитивные технологии Часть 1. - Металл
 
North Carolina County Government
North Carolina County Government North Carolina County Government
North Carolina County Government
 

Similaire à Donetsk.py - fabric

20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
garrett honeycutt
 
Hadoop 20111117
Hadoop 20111117Hadoop 20111117
Hadoop 20111117
exsuns
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
PHPPRO
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
Carlos Sanchez
 

Similaire à Donetsk.py - fabric (20)

Fabric for fun_and_profit
Fabric for fun_and_profitFabric for fun_and_profit
Fabric for fun_and_profit
 
20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag20090514 Introducing Puppet To Sasag
20090514 Introducing Puppet To Sasag
 
Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru
Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneruJak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru
Jak se ^bonami\.(cz|pl|sk)$ vešlo do kontejneru
 
Fabric Python Lib
Fabric Python LibFabric Python Lib
Fabric Python Lib
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Belvedere
BelvedereBelvedere
Belvedere
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 
Hadoop 20111117
Hadoop 20111117Hadoop 20111117
Hadoop 20111117
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Course 102: Lecture 8: Composite Commands
Course 102: Lecture 8: Composite Commands Course 102: Lecture 8: Composite Commands
Course 102: Lecture 8: Composite Commands
 
20100425 Configuration Management With Puppet Lfnw
20100425 Configuration Management With Puppet Lfnw20100425 Configuration Management With Puppet Lfnw
20100425 Configuration Management With Puppet Lfnw
 
Learning Puppet basic thing
Learning Puppet basic thing Learning Puppet basic thing
Learning Puppet basic thing
 
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
 
Configuration management with Chef
Configuration management with ChefConfiguration management with Chef
Configuration management with Chef
 
PM : code faster
PM : code fasterPM : code faster
PM : code faster
 
Ultimate Unix Meetup Presentation
Ultimate Unix Meetup PresentationUltimate Unix Meetup Presentation
Ultimate Unix Meetup Presentation
 
Puppet
PuppetPuppet
Puppet
 
Nashville Php Symfony Presentation
Nashville Php Symfony PresentationNashville Php Symfony Presentation
Nashville Php Symfony Presentation
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Dernier (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Donetsk.py - fabric

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n