SlideShare a Scribd company logo
1 of 29
Download to read offline
Fabric workshop
(1)
Soshi Nemoto
Mulodo Vietnam Co., Ltd.
Our Purpose
Make ourselves ‘Business partner’ from
‘factory’.
Points
Engineering knowledge <- * TODAY *
Logical Thinking
Co-operation work
Resources
Meetup: http://www.meetup.com/Open-Study-Group-Saigon
Slideshare: http://www.slideshare.net/nemo-mulodo/
— Study Group —
Previous study
DevOps: What's DevOps
http://www.slideshare.net/nemo-mulodo/devops1-whats-devops-mosg	
DevOps: Vagrant
http://www.slideshare.net/nemo-mulodo/devops2-vagrant-mosg	
DevOps: Ansible
http://www.slideshare.net/nemo-mulodo/devops3-ansible-mosg	
DevOps: Ansible(2)
http://www.slideshare.net/nemo-mulodo/devops4-ansible2-mosg	
Preparation for workshop (tools)
http://www.slideshare.net/nemo-mulodo/instruction-dev-environment
Feedback of previous study
Goal
Server
Apps
Apache
PHP
MySQL
Product
Apps
Source
Data
Cron
Virtual server
Vagrant
+ ansible
+ fabric
automation
Goal
Server
Apps
Apache
PHP
MySQL
Product
Apps
Source
Data
Cron
Virtual server
Vagrant
+ ansible
+ fabric
automation
Goal
Server
Apps
Apache
PHP
MySQL
Product
Apps
Source
Data
Cron
Virtual server
Vagrant
+ ansible
+ fabric
automation
Today: learn Fabric
Fabric workshop
A radically simple IT automation engine
Share GOAL
create fabfile
AGENDA
GOAL
Create deploy tool
- deploy
- dev/staging/production
- tag name (any ascii)
- rollback
- use any tag deployed
- tag list
- remove tag.
GOAL
$ fab help
Usage:
<Deploy>
$ fab -R [ROLE] deploy
$ fab -R [ROLE] deploy:mode=[MODE],tag=[TAG],force=[True]
deploy source to servers which are defined as ROLE
Options:
mode : 'production', 'staging', ‘development(default)'
tag : any ASCII tag. (default = Epoch time + microtime)
force: set 'True' to overwrite. (default = False)
<Show existed tags>
$ fab -R [ROLE] tags
show existed tags
<Change version>
$ fab -R [ROLE] change:tag=XXXXXX
change working version to another tagged source
tag should be exactly same as shown by Tags command
<Remove specified tag>
$ fab -R [ROLE] remove:tag=XXXXXX
remove exist tags
tag should be exactly same as shown by Tags command
GOAL
DEMO
GOAL
Create deploy tool
- deploy
- dev/staging/production
- tag name (any ascii)
- rollback
- use any tag deployed
- tag list
- remove tag.
Share GOAL
create fabfile
AGENDA
local / print
remote(use Ansible inventory)
cd / file put / conditions
Install fabric (useing pip)
$ brew install python --framework
:
$ pip install fabric
Local task
$ cd {YOUR VAGRANT_DIR}
fabfile.py
---
from fabric import api
def localtest():
print "local test"
api.local('ls -al')
Local task (1)
$ fab -R {ROLE} -f {FILE} {COMMAND}
$ fab localtest
local test
[localhost] local: ls -al
total 44
drwxr-xr-x 10 nemo staff 340 Jan 14 15:05 .
drwxr-xr-x+ 427 nemo staff 14518 Jan 14 14:52 ..
drwxr-xr-x 3 nemo staff 102 Nov 19 20:10 .vagrant
-rw-r--r-- 1 nemo staff 3337 Jan 13 20:58 Vagrantfile
drwxr-xr-x 18 nemo staff 612 Jan 14 15:26 fabfile.py
-rw-r--r-- 1 nemo staff 29 Jan 7 18:34 hosts
drwxr-xr-x 6 nemo staff 204 Dec 10 18:47 playbooks
-rw-r--r-- 1 nemo staff 133 Dec 10 17:23 setup.yml
Done.
air:nemo@~/TEST_STUDY$
$ fab localtest
Share GOAL
create fabfile
AGENDA
local / print
remote(use Ansible inventory)
cd / file put / conditions
remote task
fabfile.py
---
from fabric import api
def remotetest():
print "remote test"
api.run('ls -al’)
api.sudo('ls -al’)
Remote task (2)
$ fab remotetest
No hosts found. Please specify (single) host string for connection: {IP_ADDRESS}
[192.168.33.50] run: ls -al
[192.168.33.50] out: total 44
[192.168.33.50] out: drwx------. 6 vagrant vagrant 4096 Jan 14 05:58 .
:
[192.168.33.50] out: drwxrwxr-x 3 vagrant vagrant 4096 Jan 13 11:47 src
[192.168.33.50] out:
total 44
$ fab remotetest
target host required...
$ fab -H {IP_ADDRESS} remotetest
Remote task (trouble?)
~/.ssh/config
---
Host {IP_ADDRESS_OF_YOUR_VAGRANT_MACHINE}
User vagrant
TCPKeepAlive yes
IdentityFile {PRIVATE_KEY_OF_YOUR_VAGRANT_MACHINE}
IdentitiesOnly yes
ControlPersist 2h
Where is the private key??
$ vagrant ssh-config
api.env.use_ssh_config = True
set option in your fabfile.py
Using ROLE instead of -H
$ fab -R httpd-server remotetest
:
from fabric.api import env
from fabric.decorators import roles
env.user = user
env.roledefs.update({
‘httpd-server': [‘{IP_ADDRESS}’, ‘{IP_ADDRESS}’],
'toolservers': [‘{IP_ADDRESS}’],
})
@roles(‘httpd-server')
def YOUR_COMMAND:
pass
Using ROLE (2)
But...
We want to use
Ansible inventory (hosts) file.
* Target host definition should be only one.
* The definition of targets in Fabric is in code,
so we should use Ansible’s inventory file.
Using Ansible inventory
fabfile.py
---
from ansible import inventory
from fabric.api import env, run, local
from fabric import api
inventory = inventory.Inventory('./hosts')
env.roledefs = inventory.groups_list()
env.use_ssh_config = True
def remotetest():
run('ls -al')
hosts
---
[httpd-server]
192.168.33.50
see) Ansible(1-3)
Using Ansible inventory
$ fab -R httpd-server remotetest
OK!!
Ansible inventory (Trouble?)
ex)
/usr/local/Cellar/ansible/1.9.4/libexec/lib/python2.7/site-packages
/usr/local/Cellar/ansible/1.9.4/libexec/vendor/lib/python2.7/site-
packages
fabfile.py
---
import sys
sys.path.append({YOUR_ANSIBLE_PATH})
If you couldn’t load Ansible libraries,
please set your ansible library path.
Share GOAL
create fabfile
AGENDA
local / print
remote(use Ansible inventory)
cd / file put / conditions
mkdir and cd
fabfile.py
---
from ansible import inventory
from fabric.api import env, run, local, cd
from fabric import api
inventory = inventory.Inventory('./hosts')
env.roledefs = inventory.groups_list()
env.use_ssh_config = True
def mkdir_and_cd():
run(‘mkdir -p TMP’)
with cd(‘TMP’):
run(‘pwd’)
$ fab -R httpd-server mkdir_and_cd
mkdir and cd (2)
fabfile.py
---
:
from fabric.contrib import files
:
:
def mkdir_and_cd():
if not files.exists(‘TMP’):
run(‘mkdir -p TMP’)
with cd(‘TMP’):
run(‘ls -al’)
$ fab -R httpd-server mkdir_and_cd
mkdir, cd and put
fabfile.py
---
:
from fabric.api import env, run, local, cd, put
from fabric.contrib import files
:
:
def mkdir_cd_and_put():
if not files.exists(‘TMP’):
run(‘mkdir -p TMP’)
with cd(‘TMP’):
if not files.exists({DEST_FILE}):
put({SRC_FILE}, {DEST_FILE})
$ fab -R httpd-server mkdir_cd_and_put

More Related Content

What's hot

Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestrationbcoca
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using dockerLarry Cai
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Puppet
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for DummiesŁukasz Proszek
 
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 EC2Brian Schott
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with AugeasPuppet
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done rightDan Vaida
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleRoman Rodomansky
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slidesAaron Carey
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?shirou wakayama
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Łukasz Proszek
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to AnsibleCédric Delgehier
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartHenry Stamerjohann
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecMartin Etmajer
 

What's hot (20)

Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 
Learn basic ansible using docker
Learn basic ansible using dockerLearn basic ansible using docker
Learn basic ansible using docker
 
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
Building and Testing from Scratch a Puppet Environment with Docker - PuppetCo...
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
Ansible not only for Dummies
Ansible not only for DummiesAnsible not only for Dummies
Ansible not only for Dummies
 
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
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Configuration Surgery with Augeas
Configuration Surgery with AugeasConfiguration Surgery with Augeas
Configuration Surgery with Augeas
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
Deploying Symfony2 app with Ansible
Deploying Symfony2 app with AnsibleDeploying Symfony2 app with Ansible
Deploying Symfony2 app with Ansible
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slides
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
Ansible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / QuickstartAnsible Meetup Hamburg / Quickstart
Ansible Meetup Hamburg / Quickstart
 
Ansible - Introduction
Ansible - IntroductionAnsible - Introduction
Ansible - Introduction
 
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpecTest-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
 

Viewers also liked

CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)Soshi Nemoto
 
Vagrant - the essence of DevOps in a tool
Vagrant - the essence of DevOps in a toolVagrant - the essence of DevOps in a tool
Vagrant - the essence of DevOps in a toolPaul Stack
 
DevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day DevelopmentDevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day DevelopmentRob Reynolds
 
Vagrant, Chef and TYPO3 - A Love Affair
Vagrant, Chef and TYPO3 - A Love AffairVagrant, Chef and TYPO3 - A Love Affair
Vagrant, Chef and TYPO3 - A Love AffairMichael Lihs
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleArnaud LEMAIRE
 

Viewers also liked (6)

CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)
 
Vagrant - the essence of DevOps in a tool
Vagrant - the essence of DevOps in a toolVagrant - the essence of DevOps in a tool
Vagrant - the essence of DevOps in a tool
 
DevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day DevelopmentDevOps: Using Vagrant to Enhance Your Day to Day Development
DevOps: Using Vagrant to Enhance Your Day to Day Development
 
Vagrant, Chef and TYPO3 - A Love Affair
Vagrant, Chef and TYPO3 - A Love AffairVagrant, Chef and TYPO3 - A Love Affair
Vagrant, Chef and TYPO3 - A Love Affair
 
DevOps: una breve introducción
DevOps: una breve introducciónDevOps: una breve introducción
DevOps: una breve introducción
 
DevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & AnsibleDevOps, A brief introduction to Vagrant & Ansible
DevOps, A brief introduction to Vagrant & Ansible
 

Similar to Fabric workshop(1) - (MOSG)

Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Deepak Garg
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureHabeeb Rahman
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Halil Kaya
 
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 InstagramJay Ren
 
Composer for busy developers - DPC13
Composer for busy developers - DPC13Composer for busy developers - DPC13
Composer for busy developers - DPC13Rafael Dohms
 
Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9Corey Oordt
 
OpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, tooOpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, tooinovex GmbH
 
Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015Alex S
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Performance Profiling in Rust
Performance Profiling in RustPerformance Profiling in Rust
Performance Profiling in RustInfluxData
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetOmar Reygaert
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 

Similar to Fabric workshop(1) - (MOSG) (20)

Fabric for fun_and_profit
Fabric for fun_and_profitFabric for fun_and_profit
Fabric for fun_and_profit
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012
 
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled InfrastructureCloud meets Fog & Puppet A Story of Version Controlled Infrastructure
Cloud meets Fog & Puppet A Story of Version Controlled Infrastructure
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Oracle API Gateway Installation
Oracle API Gateway InstallationOracle API Gateway Installation
Oracle API Gateway Installation
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36
 
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
 
Composer for busy developers - DPC13
Composer for busy developers - DPC13Composer for busy developers - DPC13
Composer for busy developers - DPC13
 
Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9
 
OpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, tooOpenNebula, the foreman and CentOS play nice, too
OpenNebula, the foreman and CentOS play nice, too
 
Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015Ansible is the simplest way to automate. SymfonyCafe, 2015
Ansible is the simplest way to automate. SymfonyCafe, 2015
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Performance Profiling in Rust
Performance Profiling in RustPerformance Profiling in Rust
Performance Profiling in Rust
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 

Recently uploaded

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
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 FMESafe Software
 
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, ...Angeliki Cooney
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
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, ...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
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, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
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, ...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Fabric workshop(1) - (MOSG)

  • 2. Our Purpose Make ourselves ‘Business partner’ from ‘factory’. Points Engineering knowledge <- * TODAY * Logical Thinking Co-operation work Resources Meetup: http://www.meetup.com/Open-Study-Group-Saigon Slideshare: http://www.slideshare.net/nemo-mulodo/ — Study Group —
  • 3. Previous study DevOps: What's DevOps http://www.slideshare.net/nemo-mulodo/devops1-whats-devops-mosg DevOps: Vagrant http://www.slideshare.net/nemo-mulodo/devops2-vagrant-mosg DevOps: Ansible http://www.slideshare.net/nemo-mulodo/devops3-ansible-mosg DevOps: Ansible(2) http://www.slideshare.net/nemo-mulodo/devops4-ansible2-mosg Preparation for workshop (tools) http://www.slideshare.net/nemo-mulodo/instruction-dev-environment Feedback of previous study
  • 7. Fabric workshop A radically simple IT automation engine
  • 9. GOAL Create deploy tool - deploy - dev/staging/production - tag name (any ascii) - rollback - use any tag deployed - tag list - remove tag.
  • 10. GOAL $ fab help Usage: <Deploy> $ fab -R [ROLE] deploy $ fab -R [ROLE] deploy:mode=[MODE],tag=[TAG],force=[True] deploy source to servers which are defined as ROLE Options: mode : 'production', 'staging', ‘development(default)' tag : any ASCII tag. (default = Epoch time + microtime) force: set 'True' to overwrite. (default = False) <Show existed tags> $ fab -R [ROLE] tags show existed tags <Change version> $ fab -R [ROLE] change:tag=XXXXXX change working version to another tagged source tag should be exactly same as shown by Tags command <Remove specified tag> $ fab -R [ROLE] remove:tag=XXXXXX remove exist tags tag should be exactly same as shown by Tags command
  • 12. GOAL Create deploy tool - deploy - dev/staging/production - tag name (any ascii) - rollback - use any tag deployed - tag list - remove tag.
  • 13. Share GOAL create fabfile AGENDA local / print remote(use Ansible inventory) cd / file put / conditions
  • 14. Install fabric (useing pip) $ brew install python --framework : $ pip install fabric
  • 15. Local task $ cd {YOUR VAGRANT_DIR} fabfile.py --- from fabric import api def localtest(): print "local test" api.local('ls -al')
  • 16. Local task (1) $ fab -R {ROLE} -f {FILE} {COMMAND} $ fab localtest local test [localhost] local: ls -al total 44 drwxr-xr-x 10 nemo staff 340 Jan 14 15:05 . drwxr-xr-x+ 427 nemo staff 14518 Jan 14 14:52 .. drwxr-xr-x 3 nemo staff 102 Nov 19 20:10 .vagrant -rw-r--r-- 1 nemo staff 3337 Jan 13 20:58 Vagrantfile drwxr-xr-x 18 nemo staff 612 Jan 14 15:26 fabfile.py -rw-r--r-- 1 nemo staff 29 Jan 7 18:34 hosts drwxr-xr-x 6 nemo staff 204 Dec 10 18:47 playbooks -rw-r--r-- 1 nemo staff 133 Dec 10 17:23 setup.yml Done. air:nemo@~/TEST_STUDY$ $ fab localtest
  • 17. Share GOAL create fabfile AGENDA local / print remote(use Ansible inventory) cd / file put / conditions
  • 18. remote task fabfile.py --- from fabric import api def remotetest(): print "remote test" api.run('ls -al’) api.sudo('ls -al’)
  • 19. Remote task (2) $ fab remotetest No hosts found. Please specify (single) host string for connection: {IP_ADDRESS} [192.168.33.50] run: ls -al [192.168.33.50] out: total 44 [192.168.33.50] out: drwx------. 6 vagrant vagrant 4096 Jan 14 05:58 . : [192.168.33.50] out: drwxrwxr-x 3 vagrant vagrant 4096 Jan 13 11:47 src [192.168.33.50] out: total 44 $ fab remotetest target host required... $ fab -H {IP_ADDRESS} remotetest
  • 20. Remote task (trouble?) ~/.ssh/config --- Host {IP_ADDRESS_OF_YOUR_VAGRANT_MACHINE} User vagrant TCPKeepAlive yes IdentityFile {PRIVATE_KEY_OF_YOUR_VAGRANT_MACHINE} IdentitiesOnly yes ControlPersist 2h Where is the private key?? $ vagrant ssh-config api.env.use_ssh_config = True set option in your fabfile.py
  • 21. Using ROLE instead of -H $ fab -R httpd-server remotetest : from fabric.api import env from fabric.decorators import roles env.user = user env.roledefs.update({ ‘httpd-server': [‘{IP_ADDRESS}’, ‘{IP_ADDRESS}’], 'toolservers': [‘{IP_ADDRESS}’], }) @roles(‘httpd-server') def YOUR_COMMAND: pass
  • 22. Using ROLE (2) But... We want to use Ansible inventory (hosts) file. * Target host definition should be only one. * The definition of targets in Fabric is in code, so we should use Ansible’s inventory file.
  • 23. Using Ansible inventory fabfile.py --- from ansible import inventory from fabric.api import env, run, local from fabric import api inventory = inventory.Inventory('./hosts') env.roledefs = inventory.groups_list() env.use_ssh_config = True def remotetest(): run('ls -al') hosts --- [httpd-server] 192.168.33.50 see) Ansible(1-3)
  • 24. Using Ansible inventory $ fab -R httpd-server remotetest OK!!
  • 26. Share GOAL create fabfile AGENDA local / print remote(use Ansible inventory) cd / file put / conditions
  • 27. mkdir and cd fabfile.py --- from ansible import inventory from fabric.api import env, run, local, cd from fabric import api inventory = inventory.Inventory('./hosts') env.roledefs = inventory.groups_list() env.use_ssh_config = True def mkdir_and_cd(): run(‘mkdir -p TMP’) with cd(‘TMP’): run(‘pwd’) $ fab -R httpd-server mkdir_and_cd
  • 28. mkdir and cd (2) fabfile.py --- : from fabric.contrib import files : : def mkdir_and_cd(): if not files.exists(‘TMP’): run(‘mkdir -p TMP’) with cd(‘TMP’): run(‘ls -al’) $ fab -R httpd-server mkdir_and_cd
  • 29. mkdir, cd and put fabfile.py --- : from fabric.api import env, run, local, cd, put from fabric.contrib import files : : def mkdir_cd_and_put(): if not files.exists(‘TMP’): run(‘mkdir -p TMP’) with cd(‘TMP’): if not files.exists({DEST_FILE}): put({SRC_FILE}, {DEST_FILE}) $ fab -R httpd-server mkdir_cd_and_put