SlideShare une entreprise Scribd logo
1  sur  34
Packer, where DevOps begins
Jeff Hung
@jeffhung
• github.com/jeffhung
• Works in Trend Micro
– Hadoop infrastructure
– Platform as-a Service
• Experience
– Runs agile/scrum 5 years
– Runs DevOps 2 years
What is DevOps?
DevOps 是一種 92 共識,
認真就輸了。(誤?!)
Dev ♥ Ops
Continuous
Integration / Delivery
Forever Stack
DevOps could be…
Release Early, Release Often
Fast Iteration
Forever Stack Tools
Jenkin
s New Relic
Gangli
a
Nagios
Cacti
Gradle
Ant
Solan
o
Chef
Ansible
Puppet
SaltStack
Logstash
Splunk
PaperTrial
NoSQL
Balsamiq
IaaS, PaaS
Docker
Selenium
Every software runs on
Operating System
Packer Workflow
Build Provision
Post-
Process
AWS EC2
VMware
VirtualBox
Docker
…
packer.jso
n
Packer Workflow
Build Provision
Post-
Process
AWS EC2
VMware
VirtualBox
Docker
…
packer.jso
n
packer.json
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key”: "{{env `AWS_SECRET_KEY`}}"
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region”: "us-east-1",
"source_ami": "ami-9eaa1cf6",
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "packer-example {{timestamp}}"
}]
}
The variables
section
The builders
section
The variables section
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key”: "{{env `AWS_SECRET_KEY`}}"
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region”: "us-east-1",
"source_ami": "ami-9eaa1cf6",
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "packer-example {{timestamp}}"
}]
}
User
Variables
Calls the user function to get
value
Calls the env function to get
value from environment
variables.
The env function is only
valid within the variables
section.
The builders section
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
"aws_secret_key”: "{{env `AWS_SECRET_KEY`}}"
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region”: "us-east-1",
"source_ami": "ami-9eaa1cf6",
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "packer-example {{timestamp}}"
}]
}
Creates EBS-backed AMI by launching a source
AMI and re-packaging it into a new AMI after
provisioning.
The source
AMI
Use timestamp function to make it
unique
The resulting
AMI
$ packer build -var 'aws_access_key=YOUR ACCESS KEY' 
-var 'aws_secret_key=YOUR SECRET KEY' 
packer.json
==> amazon-ebs: amazon-ebs output will be in this color.
==> amazon-ebs: Creating temporary keypair for this instance...
==> amazon-ebs: Creating temporary security group for this instance...
==> amazon-ebs: Authorizing SSH access on the temporary security group...
==> amazon-ebs: Launching a secure AWS instance...
==> amazon-ebs: Waiting for instance to become ready...
==> amazon-ebs: Connecting to the instance via SSH...
==> amazon-ebs: Stopping the source instance...
==> amazon-ebs: Waiting for the instance to stop...
==> amazon-ebs: Creating the AMI: packer-example 1371856345
==> amazon-ebs: AMI: ami-19601070
==> amazon-ebs: Waiting for AMI to become ready...
==> amazon-ebs: Terminating the source AMI instance...
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
==> amazon-ebs: Build finished.
==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs: AMIs were created:
us-east-1: ami-19601070
Builders
• Amazon EC2 (AMI)
• DigitalOcean
• Docker
• Google Compute Engine
(GCE)
• OpenStack
• Parallels
• QEMU
• VirtualBox
• VMware
Builders are responsible for creating
machines and generating images from them
for various platforms.
Packer Workflow
Build Provision
Post-
Process
AWS EC2
VMware
VirtualBox
Docker
…
packer.jso
n
Customize with provisioners
{
"variables": {…},
"builders": […],
"provisioners": [{
"type": "shell",
"script": "./scripts/install-puppet.sh”
}, {
"type": ”puppet-masterless",
"manifest_file": "puppet/manifest/site.pp",
"module_paths": [ "puppet/modules" ],
"hiera_config_path": "puppet/hiera.yaml”
}]
}
Provisioners
are executed
one by one.
1
2
Install puppet agent
{
"variables": {…},
"builders": […],
"provisioners": [{
"type": "shell",
"script": "./scripts/install-puppet.sh”
}, {
"type": ”puppet-masterless",
"manifest_file": "puppet/manifest/site.pp",
"module_paths": [ "puppet/modules" ],
"hiera_config_path": "puppet/hiera.yaml”
}]
}
Provision machines using shell
scripts
Usually we will reuse these
scripts in different kinds of
machines.
Provision with puppet scripts
{
"variables": {…},
"builders": […],
"provisioners": [{
"type": "shell",
"script": "./scripts/install-puppet.sh”
}, {
"type": ”puppet-masterless",
"manifest_file": "puppet/manifest/site.pp",
"module_paths": [ "puppet/modules" ],
"hiera_config_path": "puppet/hiera.yaml”
}]
}
No need for a puppet
server
Manifests, modules, and hiera data can all be stored
in git.
Provisioners
Templates to install and configure software
within running machines prior to turning
them into machine images.
• Remote Shell
• Local Shell
• File Uploads
• PowerShell
• Windows Shell
• Ansible
• Chef Client/Solo
• Puppet Masterless/Server
• Salt
• Windows Restart
Packer Workflow
Build Provision
Post-
Process
AWS EC2
VMware
VirtualBox
Docker
…
packer.jso
n
Local Repository
Packaging and Publishing
After the machine is built, we would like to:
• Package as a zip-ball for local use
• Package as Vagrant Box and publish on Atlas
• Preserve Vagrant Box in Local
Machin
e Built
Compres
s
Package Publish Atlas
Foo.zip Foo.box
{ …
"post-processors": [{
"type": "compress",
"output": "{{.BuildName}}-{{isotime "20060102"}}.zip"
}, [{
"type": "vagrant",
"output": "{{.BuildName}}-{{isotime "20060102"}}.box"
}, {
"type": "atlas",
"token": "{{user `atlas_token`}}",
"artifact": "trendmicro/centos62",
"artifact_type": "virtualbox",
"keep_input_artifact": true
}]]
}
Post-Processor Chains
Package as a zip-
ball for local use
Package as Vagrant
Box and publish on
Atlas
{ …
"post-processors": [{
"type": "compress",
"output": "{{.BuildName}}-{{isotime "20060102"}}.zip"
}, [{
"type": "vagrant",
"output": "{{.BuildName}}-{{isotime "20060102"}}.box"
}, {
"type": "atlas",
"token": "{{user `atlas_token`}}",
"artifact": "trendmicro/centos62",
"artifact_type": "virtualbox",
"keep_input_artifact": true
}]]
}
Compress into Single Archive
Go-style date
format
Compression format auto-inferred from
extension
{ …
"post-processors": [{
"type": "compress",
"output": "{{.BuildName}}-{{isotime "20060102"}}.zip"
}, [{
"type": "vagrant",
"output": "{{.BuildName}}-{{isotime "20060102"}}.box"
}, {
"type": "atlas",
"token": "{{user `atlas_token`}}",
"artifact": "trendmicro/centos62",
"artifact_type": "virtualbox",
"keep_input_artifact": true
}]]
}
Sequence
definition
Publish Vagrant Box
Preserve the vagrant
box packaged in
previous step
Preserve
Vagrant Box in
Local
Post-Processors
The post-processor section configures any
post-processing that will be done to image
built by the builders.
• compress
• vSphere
• Vagrant
• Vagrant Cloud
• Atlas
• docker-import
• docker-push
• docker-save
• docker-tag
What Else Do You Need?
• Kickstart
– Use kickstart file to install Linux from ISO
• chef/bento
– Vagrant Box Packer definitions by Chef
– Published on Atlas:
https://atlas.hashicorp.com/chef
• Windows
– Windows Automated Installation Kit (AIK)
– Unattended Windows Setup
Pets Cattles
Pets vs. Cattles
• Ticket-based
• Handcrafted
• Scale-up
• Smart
Hardware
• Self-Service
• Automated
• Scale-out
• Smart Apps
Jenkins
Cattles Workflow
Base.jso
n
Std.json
Win.json
Code
Dev
Dev.box
YUM repo
RPM
Web.jso
n
App.json
…
DB.json
Image repo
Web.box
App.box
…
DB.box
Win7.bo
x
…
Win8.bo
x
AWS
Build
RPM
Build
Imag
e
Deploy
App
Tower
Playbook
Jenkins
SPN (Pets) Flow
Base.jso
n
Std.json
Win.json
Code
Dev
Dev.box
YUM repo
RPM
Win7.bo
x
…
Win8.bo
x
DC /
AWS
Build
RPM
Deploy
App
Puppet
Manifest
To Docker
or not?
What is Your Flow?
• You need to define your DevOps flow
• No need to build Rome in one day
• Consider company culture
• Tool adoption
Summary
• DevOps  Fast Iteration
• Packer as the starting point
• Builders  Provisioners  Post-
Processors
• Pets or Cattle?
• Define Your DevOps Workflow
THANK YOU!
Alternative Format?
But we needs comments to add annotations
and disable entire experimental blocks...
It is one of the primary reason we choose
JSON as the configuration format: it is highly
convenient to write a script to generate the
configuration.
@mitchellh
.SUFFIXES: .json .yml
.yml.json:
ruby -ryaml -rjson 
-e 'puts JSON.pretty_generate(YAML.load(ARGF))' 
< $< > $@;
https://github.com/mitchellh/packer/issues/
887

Contenu connexe

Tendances

Automation with Packer and TerraForm
Automation with Packer and TerraFormAutomation with Packer and TerraForm
Automation with Packer and TerraFormWesley Charles Blake
 
(2016-06-11) Packer: Make Multi-Platform Images
(2016-06-11) Packer: Make Multi-Platform Images(2016-06-11) Packer: Make Multi-Platform Images
(2016-06-11) Packer: Make Multi-Platform Imagesgarrett honeycutt
 
OpenSource ToolChain for the Hybrid Cloud
OpenSource ToolChain for the Hybrid CloudOpenSource ToolChain for the Hybrid Cloud
OpenSource ToolChain for the Hybrid CloudIsaac Christoffersen
 
Build automated Machine Images using Packer
Build automated Machine Images using PackerBuild automated Machine Images using Packer
Build automated Machine Images using PackerMarek Piątek
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerGeorge Miranda
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStackke4qqq
 
SEP DevOps Ignite Talk - Packer
SEP DevOps Ignite Talk - PackerSEP DevOps Ignite Talk - Packer
SEP DevOps Ignite Talk - PackerRyan Sweeney
 
Automating CloudStack with Puppet - David Nalley
Automating CloudStack with Puppet - David NalleyAutomating CloudStack with Puppet - David Nalley
Automating CloudStack with Puppet - David NalleyPuppet
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackke4qqq
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible referencelaonap166
 
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'rmcleay
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slidesAaron Carey
 
Integrating cloud stack with puppet
Integrating cloud stack with puppetIntegrating cloud stack with puppet
Integrating cloud stack with puppetPuppet
 
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleLocal Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleJeff Geerling
 
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud EnvironmentsUsing Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environmentsahamilton55
 

Tendances (20)

Packer
Packer Packer
Packer
 
Automation with Packer and TerraForm
Automation with Packer and TerraFormAutomation with Packer and TerraForm
Automation with Packer and TerraForm
 
(2016-06-11) Packer: Make Multi-Platform Images
(2016-06-11) Packer: Make Multi-Platform Images(2016-06-11) Packer: Make Multi-Platform Images
(2016-06-11) Packer: Make Multi-Platform Images
 
OpenSource ToolChain for the Hybrid Cloud
OpenSource ToolChain for the Hybrid CloudOpenSource ToolChain for the Hybrid Cloud
OpenSource ToolChain for the Hybrid Cloud
 
Build automated Machine Images using Packer
Build automated Machine Images using PackerBuild automated Machine Images using Packer
Build automated Machine Images using Packer
 
EC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and PackerEC2 AMI Factory with Chef, Berkshelf, and Packer
EC2 AMI Factory with Chef, Berkshelf, and Packer
 
Packer by HashiCorp
Packer by HashiCorpPacker by HashiCorp
Packer by HashiCorp
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStack
 
SEP DevOps Ignite Talk - Packer
SEP DevOps Ignite Talk - PackerSEP DevOps Ignite Talk - Packer
SEP DevOps Ignite Talk - Packer
 
Automating CloudStack with Puppet - David Nalley
Automating CloudStack with Puppet - David NalleyAutomating CloudStack with Puppet - David Nalley
Automating CloudStack with Puppet - David Nalley
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStack
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Jenkins and ansible reference
Jenkins and ansible referenceJenkins and ansible reference
Jenkins and ansible reference
 
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
DevOps in a Regulated World - aka 'Ansible, AWS, and Jenkins'
 
Ansible and AWS
Ansible and AWSAnsible and AWS
Ansible and AWS
 
Ansible fest Presentation slides
Ansible fest Presentation slidesAnsible fest Presentation slides
Ansible fest Presentation slides
 
Integrating cloud stack with puppet
Integrating cloud stack with puppetIntegrating cloud stack with puppet
Integrating cloud stack with puppet
 
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleLocal Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
 
Using Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud EnvironmentsUsing Ansible for Deploying to Cloud Environments
Using Ansible for Deploying to Cloud Environments
 
Cyansible
CyansibleCyansible
Cyansible
 

En vedette

Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsTomas Doran
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerCristovao G. Verstraeten
 
Death to the DevOps team - Agile Yorkshire 2014
Death to the DevOps team - Agile Yorkshire 2014Death to the DevOps team - Agile Yorkshire 2014
Death to the DevOps team - Agile Yorkshire 2014Matthew Skelton
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and ChefScaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chefbridgetkromhout
 
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) PipelineAnatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) PipelineRobert McDermott
 
Automic Empowering Business Through Automation
Automic Empowering Business Through AutomationAutomic Empowering Business Through Automation
Automic Empowering Business Through AutomationCA | Automic Software
 
The Road to Continuous Delivery at Perforce
The Road to Continuous Delivery at PerforceThe Road to Continuous Delivery at Perforce
The Road to Continuous Delivery at PerforcePerforce
 
AWS Summit Paris - Track 3 - Session 3 - Découvrez Amazon WorkSpaces et WorkS...
AWS Summit Paris - Track 3 - Session 3 - Découvrez Amazon WorkSpaces et WorkS...AWS Summit Paris - Track 3 - Session 3 - Découvrez Amazon WorkSpaces et WorkS...
AWS Summit Paris - Track 3 - Session 3 - Découvrez Amazon WorkSpaces et WorkS...Amazon Web Services
 
Cluj.DevOps Meetup - Code your Infrastructure
Cluj.DevOps Meetup - Code your InfrastructureCluj.DevOps Meetup - Code your Infrastructure
Cluj.DevOps Meetup - Code your InfrastructureLiviu Damian
 
CoreOS fest 2016 Summary - DevOps BP 2016 June
CoreOS fest 2016 Summary - DevOps BP 2016 JuneCoreOS fest 2016 Summary - DevOps BP 2016 June
CoreOS fest 2016 Summary - DevOps BP 2016 JuneZsolt Molnar
 
Continuous delivery with Jenkins Enterprise and Deployit
Continuous delivery with Jenkins Enterprise and DeployitContinuous delivery with Jenkins Enterprise and Deployit
Continuous delivery with Jenkins Enterprise and DeployitXebiaLabs
 
Getting started with salt stack
Getting started with salt stackGetting started with salt stack
Getting started with salt stackSuresh Paulraj
 
Real-time Cloud Management with SaltStack
Real-time Cloud Management with SaltStackReal-time Cloud Management with SaltStack
Real-time Cloud Management with SaltStackSaltStack
 
Build & test once, deploy anywhere - Vday.hu 2016
Build & test once, deploy anywhere - Vday.hu 2016Build & test once, deploy anywhere - Vday.hu 2016
Build & test once, deploy anywhere - Vday.hu 2016Zsolt Molnar
 
DevOps and Splunk
DevOps and SplunkDevOps and Splunk
DevOps and SplunkSplunk
 

En vedette (17)

Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and JenkinsChasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
Chasing AMI - Building Amazon machine images with Puppet, Packer and Jenkins
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with Packer
 
Death to the DevOps team - Agile Yorkshire 2014
Death to the DevOps team - Agile Yorkshire 2014Death to the DevOps team - Agile Yorkshire 2014
Death to the DevOps team - Agile Yorkshire 2014
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and ChefScaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
 
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) PipelineAnatomy of a Continuous Integration and Delivery (CICD) Pipeline
Anatomy of a Continuous Integration and Delivery (CICD) Pipeline
 
Automic Empowering Business Through Automation
Automic Empowering Business Through AutomationAutomic Empowering Business Through Automation
Automic Empowering Business Through Automation
 
The Road to Continuous Delivery at Perforce
The Road to Continuous Delivery at PerforceThe Road to Continuous Delivery at Perforce
The Road to Continuous Delivery at Perforce
 
AWS Summit Paris - Track 3 - Session 3 - Découvrez Amazon WorkSpaces et WorkS...
AWS Summit Paris - Track 3 - Session 3 - Découvrez Amazon WorkSpaces et WorkS...AWS Summit Paris - Track 3 - Session 3 - Découvrez Amazon WorkSpaces et WorkS...
AWS Summit Paris - Track 3 - Session 3 - Découvrez Amazon WorkSpaces et WorkS...
 
Cluj.DevOps Meetup - Code your Infrastructure
Cluj.DevOps Meetup - Code your InfrastructureCluj.DevOps Meetup - Code your Infrastructure
Cluj.DevOps Meetup - Code your Infrastructure
 
CoreOS fest 2016 Summary - DevOps BP 2016 June
CoreOS fest 2016 Summary - DevOps BP 2016 JuneCoreOS fest 2016 Summary - DevOps BP 2016 June
CoreOS fest 2016 Summary - DevOps BP 2016 June
 
Continuous delivery with Jenkins Enterprise and Deployit
Continuous delivery with Jenkins Enterprise and DeployitContinuous delivery with Jenkins Enterprise and Deployit
Continuous delivery with Jenkins Enterprise and Deployit
 
Getting started with salt stack
Getting started with salt stackGetting started with salt stack
Getting started with salt stack
 
Real-time Cloud Management with SaltStack
Real-time Cloud Management with SaltStackReal-time Cloud Management with SaltStack
Real-time Cloud Management with SaltStack
 
Consul and Consul Pusher
Consul and Consul PusherConsul and Consul Pusher
Consul and Consul Pusher
 
Build & test once, deploy anywhere - Vday.hu 2016
Build & test once, deploy anywhere - Vday.hu 2016Build & test once, deploy anywhere - Vday.hu 2016
Build & test once, deploy anywhere - Vday.hu 2016
 
DevOps and Splunk
DevOps and SplunkDevOps and Splunk
DevOps and Splunk
 

Similaire à Packer, where DevOps begins

Immutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and JenkinsImmutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and JenkinsManish Pandit
 
Assembling an Open Source Toolchain to Manage Public, Private and Hybrid Clou...
Assembling an Open Source Toolchain to Manage Public, Private and Hybrid Clou...Assembling an Open Source Toolchain to Manage Public, Private and Hybrid Clou...
Assembling an Open Source Toolchain to Manage Public, Private and Hybrid Clou...POSSCON
 
DevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursDevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursAmazon Web Services
 
Immutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaImmutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaAOE
 
(ARC401) Cloud First: New Architecture for New Infrastructure
(ARC401) Cloud First: New Architecture for New Infrastructure(ARC401) Cloud First: New Architecture for New Infrastructure
(ARC401) Cloud First: New Architecture for New InfrastructureAmazon Web Services
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...Amazon Web Services
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
Running your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceRunning your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceMarco Pas
 
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivSelf Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivAmazon Web Services
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStackPuppet
 
A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)Julien SIMON
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile InfrastructuresAntons Kranga
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloudKyle Rames
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpresoke4qqq
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)Soshi Nemoto
 
Getting Started with Couchbase Ruby
Getting Started with Couchbase RubyGetting Started with Couchbase Ruby
Getting Started with Couchbase RubySergey Avseyev
 

Similaire à Packer, where DevOps begins (20)

Immutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and JenkinsImmutable AWS Deployments with Packer and Jenkins
Immutable AWS Deployments with Packer and Jenkins
 
Assembling an Open Source Toolchain to Manage Public, Private and Hybrid Clou...
Assembling an Open Source Toolchain to Manage Public, Private and Hybrid Clou...Assembling an Open Source Toolchain to Manage Public, Private and Hybrid Clou...
Assembling an Open Source Toolchain to Manage Public, Private and Hybrid Clou...
 
DevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursDevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office Hours
 
Immutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaImmutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS Lambda
 
(ARC401) Cloud First: New Architecture for New Infrastructure
(ARC401) Cloud First: New Architecture for New Infrastructure(ARC401) Cloud First: New Architecture for New Infrastructure
(ARC401) Cloud First: New Architecture for New Infrastructure
 
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
(ARC402) Deployment Automation: From Developers' Keyboards to End Users' Scre...
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Running your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container ServiceRunning your dockerized application(s) on AWS Elastic Container Service
Running your dockerized application(s) on AWS Elastic Container Service
 
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivSelf Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 
Amazon ECS Deep Dive
Amazon ECS Deep DiveAmazon ECS Deep Dive
Amazon ECS Deep Dive
 
A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)
 
Antons Kranga Building Agile Infrastructures
Antons Kranga   Building Agile InfrastructuresAntons Kranga   Building Agile Infrastructures
Antons Kranga Building Agile Infrastructures
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloud
 
CI/CD on pure AWS
CI/CD on pure AWSCI/CD on pure AWS
CI/CD on pure AWS
 
EC2 Container Service
EC2 Container ServiceEC2 Container Service
EC2 Container Service
 
Puppetpreso
PuppetpresoPuppetpreso
Puppetpreso
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Getting Started with Couchbase Ruby
Getting Started with Couchbase RubyGetting Started with Couchbase Ruby
Getting Started with Couchbase Ruby
 
Amazon EC2 Container Service
Amazon EC2 Container ServiceAmazon EC2 Container Service
Amazon EC2 Container Service
 

Dernier

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 

Dernier (20)

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

Packer, where DevOps begins

  • 1. Packer, where DevOps begins Jeff Hung
  • 2. @jeffhung • github.com/jeffhung • Works in Trend Micro – Hadoop infrastructure – Platform as-a Service • Experience – Runs agile/scrum 5 years – Runs DevOps 2 years
  • 4. DevOps 是一種 92 共識, 認真就輸了。(誤?!)
  • 5. Dev ♥ Ops Continuous Integration / Delivery Forever Stack DevOps could be…
  • 6. Release Early, Release Often Fast Iteration
  • 7. Forever Stack Tools Jenkin s New Relic Gangli a Nagios Cacti Gradle Ant Solan o Chef Ansible Puppet SaltStack Logstash Splunk PaperTrial NoSQL Balsamiq IaaS, PaaS Docker Selenium Every software runs on Operating System
  • 8.
  • 9. Packer Workflow Build Provision Post- Process AWS EC2 VMware VirtualBox Docker … packer.jso n
  • 10. Packer Workflow Build Provision Post- Process AWS EC2 VMware VirtualBox Docker … packer.jso n
  • 11. packer.json { "variables": { "aws_access_key": "{{env `AWS_ACCESS_KEY`}}", "aws_secret_key”: "{{env `AWS_SECRET_KEY`}}" }, "builders": [{ "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region”: "us-east-1", "source_ami": "ami-9eaa1cf6", "instance_type": "t2.micro", "ssh_username": "ubuntu", "ami_name": "packer-example {{timestamp}}" }] } The variables section The builders section
  • 12. The variables section { "variables": { "aws_access_key": "{{env `AWS_ACCESS_KEY`}}", "aws_secret_key”: "{{env `AWS_SECRET_KEY`}}" }, "builders": [{ "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region”: "us-east-1", "source_ami": "ami-9eaa1cf6", "instance_type": "t2.micro", "ssh_username": "ubuntu", "ami_name": "packer-example {{timestamp}}" }] } User Variables Calls the user function to get value Calls the env function to get value from environment variables. The env function is only valid within the variables section.
  • 13. The builders section { "variables": { "aws_access_key": "{{env `AWS_ACCESS_KEY`}}", "aws_secret_key”: "{{env `AWS_SECRET_KEY`}}" }, "builders": [{ "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region”: "us-east-1", "source_ami": "ami-9eaa1cf6", "instance_type": "t2.micro", "ssh_username": "ubuntu", "ami_name": "packer-example {{timestamp}}" }] } Creates EBS-backed AMI by launching a source AMI and re-packaging it into a new AMI after provisioning. The source AMI Use timestamp function to make it unique The resulting AMI
  • 14. $ packer build -var 'aws_access_key=YOUR ACCESS KEY' -var 'aws_secret_key=YOUR SECRET KEY' packer.json ==> amazon-ebs: amazon-ebs output will be in this color. ==> amazon-ebs: Creating temporary keypair for this instance... ==> amazon-ebs: Creating temporary security group for this instance... ==> amazon-ebs: Authorizing SSH access on the temporary security group... ==> amazon-ebs: Launching a secure AWS instance... ==> amazon-ebs: Waiting for instance to become ready... ==> amazon-ebs: Connecting to the instance via SSH... ==> amazon-ebs: Stopping the source instance... ==> amazon-ebs: Waiting for the instance to stop... ==> amazon-ebs: Creating the AMI: packer-example 1371856345 ==> amazon-ebs: AMI: ami-19601070 ==> amazon-ebs: Waiting for AMI to become ready... ==> amazon-ebs: Terminating the source AMI instance... ==> amazon-ebs: Deleting temporary security group... ==> amazon-ebs: Deleting temporary keypair... ==> amazon-ebs: Build finished. ==> Builds finished. The artifacts of successful builds are: --> amazon-ebs: AMIs were created: us-east-1: ami-19601070
  • 15. Builders • Amazon EC2 (AMI) • DigitalOcean • Docker • Google Compute Engine (GCE) • OpenStack • Parallels • QEMU • VirtualBox • VMware Builders are responsible for creating machines and generating images from them for various platforms.
  • 16. Packer Workflow Build Provision Post- Process AWS EC2 VMware VirtualBox Docker … packer.jso n
  • 17. Customize with provisioners { "variables": {…}, "builders": […], "provisioners": [{ "type": "shell", "script": "./scripts/install-puppet.sh” }, { "type": ”puppet-masterless", "manifest_file": "puppet/manifest/site.pp", "module_paths": [ "puppet/modules" ], "hiera_config_path": "puppet/hiera.yaml” }] } Provisioners are executed one by one. 1 2
  • 18. Install puppet agent { "variables": {…}, "builders": […], "provisioners": [{ "type": "shell", "script": "./scripts/install-puppet.sh” }, { "type": ”puppet-masterless", "manifest_file": "puppet/manifest/site.pp", "module_paths": [ "puppet/modules" ], "hiera_config_path": "puppet/hiera.yaml” }] } Provision machines using shell scripts Usually we will reuse these scripts in different kinds of machines.
  • 19. Provision with puppet scripts { "variables": {…}, "builders": […], "provisioners": [{ "type": "shell", "script": "./scripts/install-puppet.sh” }, { "type": ”puppet-masterless", "manifest_file": "puppet/manifest/site.pp", "module_paths": [ "puppet/modules" ], "hiera_config_path": "puppet/hiera.yaml” }] } No need for a puppet server Manifests, modules, and hiera data can all be stored in git.
  • 20. Provisioners Templates to install and configure software within running machines prior to turning them into machine images. • Remote Shell • Local Shell • File Uploads • PowerShell • Windows Shell • Ansible • Chef Client/Solo • Puppet Masterless/Server • Salt • Windows Restart
  • 21. Packer Workflow Build Provision Post- Process AWS EC2 VMware VirtualBox Docker … packer.jso n
  • 22. Local Repository Packaging and Publishing After the machine is built, we would like to: • Package as a zip-ball for local use • Package as Vagrant Box and publish on Atlas • Preserve Vagrant Box in Local Machin e Built Compres s Package Publish Atlas Foo.zip Foo.box
  • 23. { … "post-processors": [{ "type": "compress", "output": "{{.BuildName}}-{{isotime "20060102"}}.zip" }, [{ "type": "vagrant", "output": "{{.BuildName}}-{{isotime "20060102"}}.box" }, { "type": "atlas", "token": "{{user `atlas_token`}}", "artifact": "trendmicro/centos62", "artifact_type": "virtualbox", "keep_input_artifact": true }]] } Post-Processor Chains Package as a zip- ball for local use Package as Vagrant Box and publish on Atlas
  • 24. { … "post-processors": [{ "type": "compress", "output": "{{.BuildName}}-{{isotime "20060102"}}.zip" }, [{ "type": "vagrant", "output": "{{.BuildName}}-{{isotime "20060102"}}.box" }, { "type": "atlas", "token": "{{user `atlas_token`}}", "artifact": "trendmicro/centos62", "artifact_type": "virtualbox", "keep_input_artifact": true }]] } Compress into Single Archive Go-style date format Compression format auto-inferred from extension
  • 25. { … "post-processors": [{ "type": "compress", "output": "{{.BuildName}}-{{isotime "20060102"}}.zip" }, [{ "type": "vagrant", "output": "{{.BuildName}}-{{isotime "20060102"}}.box" }, { "type": "atlas", "token": "{{user `atlas_token`}}", "artifact": "trendmicro/centos62", "artifact_type": "virtualbox", "keep_input_artifact": true }]] } Sequence definition Publish Vagrant Box Preserve the vagrant box packaged in previous step Preserve Vagrant Box in Local
  • 26. Post-Processors The post-processor section configures any post-processing that will be done to image built by the builders. • compress • vSphere • Vagrant • Vagrant Cloud • Atlas • docker-import • docker-push • docker-save • docker-tag
  • 27. What Else Do You Need? • Kickstart – Use kickstart file to install Linux from ISO • chef/bento – Vagrant Box Packer definitions by Chef – Published on Atlas: https://atlas.hashicorp.com/chef • Windows – Windows Automated Installation Kit (AIK) – Unattended Windows Setup
  • 28. Pets Cattles Pets vs. Cattles • Ticket-based • Handcrafted • Scale-up • Smart Hardware • Self-Service • Automated • Scale-out • Smart Apps
  • 29. Jenkins Cattles Workflow Base.jso n Std.json Win.json Code Dev Dev.box YUM repo RPM Web.jso n App.json … DB.json Image repo Web.box App.box … DB.box Win7.bo x … Win8.bo x AWS Build RPM Build Imag e Deploy App Tower Playbook
  • 30. Jenkins SPN (Pets) Flow Base.jso n Std.json Win.json Code Dev Dev.box YUM repo RPM Win7.bo x … Win8.bo x DC / AWS Build RPM Deploy App Puppet Manifest To Docker or not?
  • 31. What is Your Flow? • You need to define your DevOps flow • No need to build Rome in one day • Consider company culture • Tool adoption
  • 32. Summary • DevOps  Fast Iteration • Packer as the starting point • Builders  Provisioners  Post- Processors • Pets or Cattle? • Define Your DevOps Workflow
  • 34. Alternative Format? But we needs comments to add annotations and disable entire experimental blocks... It is one of the primary reason we choose JSON as the configuration format: it is highly convenient to write a script to generate the configuration. @mitchellh .SUFFIXES: .json .yml .yml.json: ruby -ryaml -rjson -e 'puts JSON.pretty_generate(YAML.load(ARGF))' < $< > $@; https://github.com/mitchellh/packer/issues/ 887