SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

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
 

What's hot (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
 

Viewers also liked

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
 

Viewers also liked (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
 

Similar to 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
 

Similar to 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
 

Recently uploaded

Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 

Recently uploaded (20)

Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 

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