SlideShare una empresa de Scribd logo
1 de 52
Classification 2013/10/3
1
Classification 2013/10/32
What is a system admin?
Don‟t look at me...
I wasn‟t the last one to touch it...
Classification 2013/10/35
Everything the Same
Everything Distinct
Manually
yum install nginx
vi /etc/nginx/conf.d/test.conf
service nginx start
Shell Script
yum install nginx
mkdir -p /etc/nginx/conf.d
cat > /etc/nginx/conf.d/test.conf<<EOF
server {
listen 443;
ssl on;
}
EOF
service nginx start
install-nginx.sh
scp install-nginx.sh root@server:~/
ssh -o PasswordAuthentication=no -q -t -t “~/install-nginx.sh”
One Goal:
Revolutionize
System
Administration
Fabric
 command-line tool for streamlining the use of SSH for
application deployment or systems administration tasks
 Make executing shell commands over SSH easy and Pythonic
 Stop administrating your environment and start developing it...
 Re-usable code for managing your software & configurations
Installation
$ pip install fabric
$ pip install jinja2
$ sudo apt-get install fabric
fabfile.py
@task
def install_package():
run("yum install nginx")
fabfile.py
@task
def update_conf():
if exists("/etc/nginx/conf.d"):
run("mkdir -p /etc/nginx/conf.d")
put(”test.conf", "/etc/nginx/conf.d/test.conf")
fabfile.py
@task
def start_daemon():
run("service nginx start")
fabfile.py
@task
def deploy():
execute(install_package)
execute(update_conf)
execute(start_daemon)
Task Arguments
from fabric.api import task
@task
def hello(name="world"):
print("Hello %s!" % name)
Task Arguments
$ fab hello:name=Alex
Hello Alex!
Done.
$ fab hello:Alex
Hello Alex!
Done.
Template
def update_conf():
context = {
'http_port' : 80,
'https_port' : 443
}
src_path = 'test.conf'
dest_path = '/etc/nginx/conf.d/test.conf'
files.upload_template(src_path, dest_path, context = context)
Template File
server {
listen %(http_port)d;
}
server {
listen %(https_port)d;
}
Template with Jinja2
def update_conf():
context = {
„ports' : [80, 443]
}
src_path = 'test.conf'
dest_path = '/etc/nginx/conf.d/test.conf'
files.upload_template(src_path, dest_path, context = context, use_jinja =
True)
Template File with Jinja2
{%- for port in ports %}
server {
listen {{ port }};
}
{%- endfor %}
Execute Model
from fabric.api import run, env
env.hosts = ['host1', 'host2']
@task
def taskA():
run('ls')
@task
def taskB():
run('whoami')
Execute Model
$ fab -l
Available commands:
taskA
taskB
Execute Model
$ fab taskA taskB
taskA executed on host1
taskA executed on host2
taskB executed on host1
taskB executed on host2
Execute Model by Role
from fabric.api import run, env
env.roledefs = {
'web': ['www1', 'www2', 'www3'],
'dns': ['ns1', 'ns2']
}
def taskA():
run('ls')
def taskB():
run('whoami')
Execute Model by Role
$ fab -R dns taskA taskB
taskA executed on ns1
taskA executed on ns2
taskB executed on ns1
taskB executed on ns2
Execute Model by Hosts
$ fab -H ns1,www1 taskA taskB
taskA executed on ns1
taskA executed on www1
taskB executed on ns1
taskB executed on www1
Arbitrary remote commands
$ fab -H ns1,www1 -- whoami
task executed on ns1
task executed on www1
Cuisine
 https://github.com/sebastien/cuisine
 Chef-like functionality for Fabric
 Covers file/dir operations, user/group operations, package
operations
Cuisine
 text_* : Text-processing functions
 file_* : File operations
 dir_* : Directory operations
 package_* : Package management operations
 command_* : Shell commands availability
 user_* : User creation commands
 group* : Group creation commands
 mode_* : Configures cuisine's behaviour within the current
session.
 select_* : Selects a specific option, such as package back-end
(apt, yum, zypper, or pacman)
Classification 2013/10/330
Live Demo
Drawbacks
 Not easy to implement by pure operators
 Leak high-level function support
 User, file, package, service management
 Built-in environment variables
 Leak smart error handling
 Would do all things every time (depends on the implementation)
 No log, no history
 To many SSH communications (keepalive argument would help)
Puppet
 Provides a Domain Specific Language (DSL) to script with
 Classes, conditionals, selectors, variables, basic math, etc.
 Supports Linux, Solaris, BSD, OS X, Windows
 Stop administrating your environment and start developing it...
 Re-usable code for managing your software & configurations
Classification 2013/10/333
apt-get install nginx
vi /etc/nginx/conf.d/test.conf
service nginx start
Debian
yum install nginx
vi /etc/nginx/conf.d/test.conf
service nginx start
Redhat
An Analogy
Programming SysAdmin
Low-level,
non-portable
Assembly commands
and files
Abstract,
portable
Java / Python / Ruby Resources
A Partial List of Puppet
typesPackages • Supports 30 different package providers
• Abstracted for your OS automatically
• Specify „installed‟, „absent‟, or „latest‟ for desired state
• Change from „installed‟ to „latest‟ and deploy for quick
Upgrade
Services • Supports 10 different „init‟ frameworks
• Control whether a service starts on boot or is required to
be running always
• A service can be notified to restart if a configuration file
has been changed
Files/Directories • Specify ownership & permissions
• Load content from „files/‟, „templates/‟ or custom strings
• Create symlinks
• Supports 5 types to verify a file checksum
• Purge a directory of files not „maintained‟
Dashboard
apt-get install nginx
vi /etc/nginx/conf.d/test.conf
service nginx start
Package
Configuration
Service
Configuration should
get modified after
package installation
Service should restart
when configuration changes
Sample classes
class nginx::server {
$conf_dir = "/etc/nginx/conf.d"
$http_port = 80
$https_port = 443
package {"nginx":
ensure => installed
}
->
file {"nginx_conf":
path => "$conf_dir/test.conf",
content => template("nginx/conf/test.conf.erb"),
owner => 'nginx',
group => 'nginx',
mode => 644,
ensure => file
}
->
service {"nginx":
enable => true,
ensure => running
}
}
Template
 Puppet templates are flat files containing Embedded Ruby
(ERB) variables
server {
listen <%= @http_port %>;
}
server {
listen <%= @https_port %>;
}
Node
Node definitions look just like classes, including supporting
inheritance, but they are special in that when a node (a managed
computer running the Puppet client) connects to the Puppet master
daemon.
node „www1' {
include nginx:server
}
Modules
A module is just a directory with stuff in it, and the
magic comes from putting that stuff where Puppet
expects to find it.
Module Structure
Network Overview
 Configuration allows for manual synchronizations or a set increment
 Client or server initiated synchronizations
 Client/Server configuration leverages a Certificate Authority (CA) on the Puppet Master to
sign client certificates to verify authenticity
 Transmissions of all data between a master & client are encrypted
Every Client
 Retrieve resource catalog from central server
 Determine resource order
 Check each resource in turn, fixing if necessary
 Rinse and repeat, every 30 minutes
Every Resource
 Retrieve current state (e.g., by querying dpkg db or doing a stat)
 Compare to desired state
 Fix, if necessary (or just log)
Drawbacks
 Hard to prepare the environment
 Install Ruby, puppet packages
 Set up host name, domain name
 Put ssh public key to every client
 Configure certificate
 Hard to control deployment time (in daemon mode)
 Hard to support rolling upgrade
 No global view, no service dependency control across hosts
Combine Fabric and Puppet
 Fabric
 When
 Operators trigger puppet to deploy packages one by one or parallelly
 Rolling upgrade
 Where
 Use fab -R or fab -H
 Initial functions
 Global setup and teardown functions
 Puppet
 What
 Define puppet nodes
 How
 Define puppet classes and templates
 Reporting
 Update the status to puppet dashboard
Initial functions
 Create EC2 instances (optional)
 Setup SSH keys to all remote hosts
 Configure yum repositories
 Install puppet and ruby packages
 Configure puppet and update new hosts to cert list
Global setup functions
 Mandatory
 Backup
 Clean yum cache
 Sync fabric configurations to puppet pp files
 Restart puppet master service
 Optional
 Clean the environment if necessary
 Put ssh public key
 Put yum repo files
 Install system development tools
 Install ruby and puppet packages
 Update puppet patches
 Configure puppet environment
Global teardown functions
 Start/stop services across hosts
 Send email/SMS notifications to members
 Do health/sanity check
Classification 2013/10/352
Questions?

Más contenido relacionado

La actualidad más candente

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
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Carlos Sanchez
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopLorin Hochstein
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
Ansible ex407 and EX 294
Ansible ex407 and EX 294Ansible ex407 and EX 294
Ansible ex407 and EX 294IkiArif1
 
Red Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetRed Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetMichael Lessard
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with AnsibleRayed Alrashed
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012Carlos Sanchez
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOpsОмские ИТ-субботники
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Composeraccoony
 
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructureDaegwon Kim
 
Continuous infrastructure testing
Continuous infrastructure testingContinuous infrastructure testing
Continuous infrastructure testingDaniel Paulus
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleRobert Reiz
 
Amazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionAmazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionRemotty
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksCarlos Sanchez
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Carlos Sanchez
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Keith Resar
 

La actualidad más candente (20)

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
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
Vagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptopVagrant, Ansible, and OpenStack on your laptop
Vagrant, Ansible, and OpenStack on your laptop
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Ansible ex407 and EX 294
Ansible ex407 and EX 294Ansible ex407 and EX 294
Ansible ex407 and EX 294
 
Red Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with PuppetRed Hat Satellite 6 - Automation with Puppet
Red Hat Satellite 6 - Automation with Puppet
 
IT Automation with Ansible
IT Automation with AnsibleIT Automation with Ansible
IT Automation with Ansible
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
 
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
파이썬 개발환경 구성하기의 끝판왕 - Docker Compose
 
이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure이미지 기반의 배포 패러다임 Immutable infrastructure
이미지 기반의 배포 패러다임 Immutable infrastructure
 
Continuous infrastructure testing
Continuous infrastructure testingContinuous infrastructure testing
Continuous infrastructure testing
 
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & AnsibleInfrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
 
Amazon EC2 Container Service in Action
Amazon EC2 Container Service in ActionAmazon EC2 Container Service in Action
Amazon EC2 Container Service in Action
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
 

Similar a One click deployment

Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with PuppetJoe Ray
 
Using puppet
Using puppetUsing puppet
Using puppetAlex Su
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_nye
 
Docker for Java developers at JavaLand
Docker for Java developers at JavaLandDocker for Java developers at JavaLand
Docker for Java developers at JavaLandJohan Janssen
 
#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
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAkshaya Mahapatra
 
Professional deployment
Professional deploymentProfessional deployment
Professional deploymentIvelina Dimova
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with PuppetAlessandro Franceschi
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Deepak Garg
 
Puppet for Developers
Puppet for DevelopersPuppet for Developers
Puppet for Developerssagarhere4u
 
Continuous delivery with docker
Continuous delivery with dockerContinuous delivery with docker
Continuous delivery with dockerJohan Janssen
 
Puppet slides for intelligrape
Puppet slides for intelligrapePuppet slides for intelligrape
Puppet slides for intelligrapeSharad Aggarwal
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of AnsibleDevOps Ltd.
 
A Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceohadlevy
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnAppWalter Heck
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet
 

Similar a One click deployment (20)

Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Provisioning with Puppet
Provisioning with PuppetProvisioning with Puppet
Provisioning with Puppet
 
Using puppet
Using puppetUsing puppet
Using puppet
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Puppet
PuppetPuppet
Puppet
 
Docker for Java developers at JavaLand
Docker for Java developers at JavaLandDocker for Java developers at JavaLand
Docker for Java developers at JavaLand
 
#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible#OktoCampus - Workshop : An introduction to Ansible
#OktoCampus - Workshop : An introduction to Ansible
 
Automating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps ApproachAutomating Software Development Life Cycle - A DevOps Approach
Automating Software Development Life Cycle - A DevOps Approach
 
Puppet
PuppetPuppet
Puppet
 
Professional deployment
Professional deploymentProfessional deployment
Professional deployment
 
Developing IT infrastructures with Puppet
Developing IT infrastructures with PuppetDeveloping IT infrastructures with Puppet
Developing IT infrastructures with Puppet
 
Bangpypers april-meetup-2012
Bangpypers april-meetup-2012Bangpypers april-meetup-2012
Bangpypers april-meetup-2012
 
Puppet for Developers
Puppet for DevelopersPuppet for Developers
Puppet for Developers
 
Continuous delivery with docker
Continuous delivery with dockerContinuous delivery with docker
Continuous delivery with docker
 
Puppet slides for intelligrape
Puppet slides for intelligrapePuppet slides for intelligrape
Puppet slides for intelligrape
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
A tour of Ansible
A tour of AnsibleA tour of Ansible
A tour of Ansible
 
A Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conferenceA Presentation about Puppet that I've made at the OSSPAC conference
A Presentation about Puppet that I've made at the OSSPAC conference
 
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PuppetCamp SEA 1 - Puppet Deployment  at OnAppPuppetCamp SEA 1 - Puppet Deployment  at OnApp
PuppetCamp SEA 1 - Puppet Deployment at OnApp
 
Puppet Deployment at OnApp
Puppet Deployment at OnApp Puppet Deployment at OnApp
Puppet Deployment at OnApp
 

Más de Alex Su

Node js introduction
Node js introductionNode js introduction
Node js introductionAlex Su
 
Scrum Introduction
Scrum IntroductionScrum Introduction
Scrum IntroductionAlex Su
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis IntroductionAlex Su
 
Python decorators
Python decoratorsPython decorators
Python decoratorsAlex Su
 
JMS Introduction
JMS IntroductionJMS Introduction
JMS IntroductionAlex Su
 
Spring Framework Introduction
Spring Framework IntroductionSpring Framework Introduction
Spring Framework IntroductionAlex Su
 
Java Unit Test and Coverage Introduction
Java Unit Test and Coverage IntroductionJava Unit Test and Coverage Introduction
Java Unit Test and Coverage IntroductionAlex Su
 
Cascading introduction
Cascading introductionCascading introduction
Cascading introductionAlex Su
 

Más de Alex Su (8)

Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Scrum Introduction
Scrum IntroductionScrum Introduction
Scrum Introduction
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
Python decorators
Python decoratorsPython decorators
Python decorators
 
JMS Introduction
JMS IntroductionJMS Introduction
JMS Introduction
 
Spring Framework Introduction
Spring Framework IntroductionSpring Framework Introduction
Spring Framework Introduction
 
Java Unit Test and Coverage Introduction
Java Unit Test and Coverage IntroductionJava Unit Test and Coverage Introduction
Java Unit Test and Coverage Introduction
 
Cascading introduction
Cascading introductionCascading introduction
Cascading introduction
 

Último

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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 WoodJuan lago vázquez
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 

One click deployment

  • 3. What is a system admin?
  • 4. Don‟t look at me... I wasn‟t the last one to touch it...
  • 5. Classification 2013/10/35 Everything the Same Everything Distinct
  • 6. Manually yum install nginx vi /etc/nginx/conf.d/test.conf service nginx start
  • 7. Shell Script yum install nginx mkdir -p /etc/nginx/conf.d cat > /etc/nginx/conf.d/test.conf<<EOF server { listen 443; ssl on; } EOF service nginx start install-nginx.sh scp install-nginx.sh root@server:~/ ssh -o PasswordAuthentication=no -q -t -t “~/install-nginx.sh”
  • 9. Fabric  command-line tool for streamlining the use of SSH for application deployment or systems administration tasks  Make executing shell commands over SSH easy and Pythonic  Stop administrating your environment and start developing it...  Re-usable code for managing your software & configurations
  • 10. Installation $ pip install fabric $ pip install jinja2 $ sudo apt-get install fabric
  • 12. fabfile.py @task def update_conf(): if exists("/etc/nginx/conf.d"): run("mkdir -p /etc/nginx/conf.d") put(”test.conf", "/etc/nginx/conf.d/test.conf")
  • 15. Task Arguments from fabric.api import task @task def hello(name="world"): print("Hello %s!" % name)
  • 16. Task Arguments $ fab hello:name=Alex Hello Alex! Done. $ fab hello:Alex Hello Alex! Done.
  • 17. Template def update_conf(): context = { 'http_port' : 80, 'https_port' : 443 } src_path = 'test.conf' dest_path = '/etc/nginx/conf.d/test.conf' files.upload_template(src_path, dest_path, context = context)
  • 18. Template File server { listen %(http_port)d; } server { listen %(https_port)d; }
  • 19. Template with Jinja2 def update_conf(): context = { „ports' : [80, 443] } src_path = 'test.conf' dest_path = '/etc/nginx/conf.d/test.conf' files.upload_template(src_path, dest_path, context = context, use_jinja = True)
  • 20. Template File with Jinja2 {%- for port in ports %} server { listen {{ port }}; } {%- endfor %}
  • 21. Execute Model from fabric.api import run, env env.hosts = ['host1', 'host2'] @task def taskA(): run('ls') @task def taskB(): run('whoami')
  • 22. Execute Model $ fab -l Available commands: taskA taskB
  • 23. Execute Model $ fab taskA taskB taskA executed on host1 taskA executed on host2 taskB executed on host1 taskB executed on host2
  • 24. Execute Model by Role from fabric.api import run, env env.roledefs = { 'web': ['www1', 'www2', 'www3'], 'dns': ['ns1', 'ns2'] } def taskA(): run('ls') def taskB(): run('whoami')
  • 25. Execute Model by Role $ fab -R dns taskA taskB taskA executed on ns1 taskA executed on ns2 taskB executed on ns1 taskB executed on ns2
  • 26. Execute Model by Hosts $ fab -H ns1,www1 taskA taskB taskA executed on ns1 taskA executed on www1 taskB executed on ns1 taskB executed on www1
  • 27. Arbitrary remote commands $ fab -H ns1,www1 -- whoami task executed on ns1 task executed on www1
  • 28. Cuisine  https://github.com/sebastien/cuisine  Chef-like functionality for Fabric  Covers file/dir operations, user/group operations, package operations
  • 29. Cuisine  text_* : Text-processing functions  file_* : File operations  dir_* : Directory operations  package_* : Package management operations  command_* : Shell commands availability  user_* : User creation commands  group* : Group creation commands  mode_* : Configures cuisine's behaviour within the current session.  select_* : Selects a specific option, such as package back-end (apt, yum, zypper, or pacman)
  • 31. Drawbacks  Not easy to implement by pure operators  Leak high-level function support  User, file, package, service management  Built-in environment variables  Leak smart error handling  Would do all things every time (depends on the implementation)  No log, no history  To many SSH communications (keepalive argument would help)
  • 32. Puppet  Provides a Domain Specific Language (DSL) to script with  Classes, conditionals, selectors, variables, basic math, etc.  Supports Linux, Solaris, BSD, OS X, Windows  Stop administrating your environment and start developing it...  Re-usable code for managing your software & configurations
  • 33. Classification 2013/10/333 apt-get install nginx vi /etc/nginx/conf.d/test.conf service nginx start Debian yum install nginx vi /etc/nginx/conf.d/test.conf service nginx start Redhat
  • 34. An Analogy Programming SysAdmin Low-level, non-portable Assembly commands and files Abstract, portable Java / Python / Ruby Resources
  • 35. A Partial List of Puppet typesPackages • Supports 30 different package providers • Abstracted for your OS automatically • Specify „installed‟, „absent‟, or „latest‟ for desired state • Change from „installed‟ to „latest‟ and deploy for quick Upgrade Services • Supports 10 different „init‟ frameworks • Control whether a service starts on boot or is required to be running always • A service can be notified to restart if a configuration file has been changed Files/Directories • Specify ownership & permissions • Load content from „files/‟, „templates/‟ or custom strings • Create symlinks • Supports 5 types to verify a file checksum • Purge a directory of files not „maintained‟
  • 37. apt-get install nginx vi /etc/nginx/conf.d/test.conf service nginx start Package Configuration Service Configuration should get modified after package installation Service should restart when configuration changes
  • 38. Sample classes class nginx::server { $conf_dir = "/etc/nginx/conf.d" $http_port = 80 $https_port = 443 package {"nginx": ensure => installed } -> file {"nginx_conf": path => "$conf_dir/test.conf", content => template("nginx/conf/test.conf.erb"), owner => 'nginx', group => 'nginx', mode => 644, ensure => file } -> service {"nginx": enable => true, ensure => running } }
  • 39. Template  Puppet templates are flat files containing Embedded Ruby (ERB) variables server { listen <%= @http_port %>; } server { listen <%= @https_port %>; }
  • 40. Node Node definitions look just like classes, including supporting inheritance, but they are special in that when a node (a managed computer running the Puppet client) connects to the Puppet master daemon. node „www1' { include nginx:server }
  • 41. Modules A module is just a directory with stuff in it, and the magic comes from putting that stuff where Puppet expects to find it.
  • 43. Network Overview  Configuration allows for manual synchronizations or a set increment  Client or server initiated synchronizations  Client/Server configuration leverages a Certificate Authority (CA) on the Puppet Master to sign client certificates to verify authenticity  Transmissions of all data between a master & client are encrypted
  • 44. Every Client  Retrieve resource catalog from central server  Determine resource order  Check each resource in turn, fixing if necessary  Rinse and repeat, every 30 minutes
  • 45. Every Resource  Retrieve current state (e.g., by querying dpkg db or doing a stat)  Compare to desired state  Fix, if necessary (or just log)
  • 46.
  • 47. Drawbacks  Hard to prepare the environment  Install Ruby, puppet packages  Set up host name, domain name  Put ssh public key to every client  Configure certificate  Hard to control deployment time (in daemon mode)  Hard to support rolling upgrade  No global view, no service dependency control across hosts
  • 48. Combine Fabric and Puppet  Fabric  When  Operators trigger puppet to deploy packages one by one or parallelly  Rolling upgrade  Where  Use fab -R or fab -H  Initial functions  Global setup and teardown functions  Puppet  What  Define puppet nodes  How  Define puppet classes and templates  Reporting  Update the status to puppet dashboard
  • 49. Initial functions  Create EC2 instances (optional)  Setup SSH keys to all remote hosts  Configure yum repositories  Install puppet and ruby packages  Configure puppet and update new hosts to cert list
  • 50. Global setup functions  Mandatory  Backup  Clean yum cache  Sync fabric configurations to puppet pp files  Restart puppet master service  Optional  Clean the environment if necessary  Put ssh public key  Put yum repo files  Install system development tools  Install ruby and puppet packages  Update puppet patches  Configure puppet environment
  • 51. Global teardown functions  Start/stop services across hosts  Send email/SMS notifications to members  Do health/sanity check