SlideShare a Scribd company logo
Packer openstack
Jan Collijs
@visibilityspots
Jan CollijsJan Collijs
● Linux & Open-Source enthousiastLinux & Open-Source enthousiast
● Made my hobby my profession 5 years agoMade my hobby my profession 5 years ago
@inuits@inuits
● Want to drink cocktails at the beach whileWant to drink cocktails at the beach while
everything is automatedeverything is automated
Use caseUse case
● Automated test suite using some CPE/CSAutomated test suite using some CPE/CS
(centos) devices(centos) devices
● Used to be a serverpark maintained by puppetUsed to be a serverpark maintained by puppet
● Want a more flexible way of using resourcesWant a more flexible way of using resources
● ReproducibleReproducible
● FastFast
Private cloud solutionPrivate cloud solution
● RDORDO
● https://www.rdoproject.orghttps://www.rdoproject.org
● packstackpackstack
VagrantVagrant
● Development Environments Made EasyDevelopment Environments Made Easy
● Local environment based on puppetLocal environment based on puppet
● Using vagrant-lxc containers or virtualboxUsing vagrant-lxc containers or virtualbox
– https://github.com/visibilityspots/vagrant-puppethttps://github.com/visibilityspots/vagrant-puppet
● ServerspecServerspec
– http://serverspec.orghttp://serverspec.org
– With Serverspec, you can write RSpec testsWith Serverspec, you can write RSpec tests
for checking your servers are configuredfor checking your servers are configured
correctly.correctly.
VagrantfileVagrantfileVAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision "shell", inline: "true"
config.vm.provider :virtualbox do |virtualbox, override|
override.vm.box = "vStone/centos-6.x-puppet.3.x"
end
config.vm.provider :lxc do |lxc, override|
override.vm.box = "visibilityspots/centos-6.x-puppet-3.x"
end
config.vm.define :cpe do |cpe|
cpe.vm.host_name = "cpe"
cpe.vm.synced_folder "hieradata", "/etc/hiera"
ext_env = ENV['VAGRANT_PUPPET_ENV']
ext_env = 'development'
env = ext_env ? ext_env : config_env
cpe.vm.synced_folder "puppet/environments/#{env}/modules", "/etc/puppet/environments/#{env}/modules"
cpe.vm.synced_folder "spec/", "/tmp/tests"
cpe.vm.provision :puppet do |puppet|
puppet.options = "--environment #{env}"
puppet.hiera_config_path = "hieradata/hiera.yaml"
puppet.manifests_path = "puppet/environments/#{env}/manifests"
puppet.manifest_file = ""
puppet.module_path = "puppet/environments/#{env}/modules"
end
end
end
require 'vagrant-openstack-provider'
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision "shell", inline: "true"
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
config.vm.provider :virtualbox do |virtualbox, override|
override.vm.box = "vStone/centos-6.x-puppet.3.x"
end
config.vm.provider :lxc do |lxc, override|
override.vm.box = "visibilityspots/centos-6.x-puppet-3.x"
end
config.vm.provider :openstack do|os, override|
override.nfs.functional = false
override.ssh.pty = true
override.ssh.username = "root"
os.flavor = "m1.small"
os.image = "centos-base-image"
os.availability_zone = "default"
os.security_groups = ['default']
os.openstack_auth_url = "http://#.#.#.#/v2.0/tokens"
os.tenant_name = "tenant"
os.keypair_name = "tenant"
os.username = "centos"
os.password = "password"
override.ssh.private_key_path = "/path/to/ssh/key"
os.networks = [
'net-tenant',
]
end
config.vm.define :cpe do |cpe|
cpe.vm.host_name = "cpe"
cpe.vm.synced_folder "hieradata", "/etc/hiera"
ext_env = ENV['VAGRANT_PUPPET_ENV']
ext_env = 'development'
env = ext_env ? ext_env : config_env
cpe.vm.synced_folder "puppet/environments/#{env}/modules", "/etc/puppet/environments/#{env}/modules"
cpe.vm.synced_folder "spec/", "/tmp/tests"
cpe.vm.provision :puppet do |puppet|
puppet.options = "--environment #{env}"
puppet.hiera_config_path = "hieradata/hiera.yaml"
puppet.manifests_path = "puppet/environments/#{env}/manifests"
puppet.manifest_file = ""
puppet.module_path = "puppet/environments/#{env}/modules"
end
end
end
Packer.ioPacker.io
● Build Automated Machine ImagesBuild Automated Machine Images
● Using puppetUsing puppet
● Based on a centos minimal with kickstart in initialBased on a centos minimal with kickstart in initial
phasephase
● ServerspecServerspec
– With Serverspec, you can write RSpec testsWith Serverspec, you can write RSpec tests
for checking your servers are configuredfor checking your servers are configured
correctly.correctly.
● Based on a centos cloud based imageBased on a centos cloud based image
– https://wiki.centos.org/Cloudhttps://wiki.centos.org/Cloud
PackerfilePackerfile
{
"provisioners": [
{
"type": "file",
"source": "hieradata",
"destination": "/tmp"
},
{
"type": "file",
"source": "tests",
"destination": "/tmp"
},
{
"type": "shell",
"execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"scripts": [
"scripts/installrepos.sh",
"scripts/initialize.sh",
"scripts/installrvm.sh",
"scripts/installserverspec.sh"
]
},
{
"type": "puppet-masterless",
"manifest_file": "puppet/environments/production/manifests/",
"hiera_config_path": "hieradata/hiera.yaml",
"module_paths": "puppet/environments/production/modules/"
},
{
"type": "shell",
"execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"scripts": [
"scripts/serverspec.sh",
"scripts/cleanup.sh",
"scripts/zerodisk.sh"
]
}
],
"builders": [
{
"availability_zone": "nova",
"type": "openstack",
"ssh_username": "username",
"tenant_name": "tenant",
"region": "RegionOne",
"image_name": "cpe",
"source_image": "####",
"flavor": "cpe.tiny",
"networks": ["####"],
"ssh_pty" : true
}
]
}
JenkinsJenkins
● The leading open source automation server,The leading open source automation server,
Jenkins provides hundreds of plugins to supportJenkins provides hundreds of plugins to support
building, deploying and automating any project.building, deploying and automating any project.
● https://jenkins.iohttps://jenkins.io
Jenkins jobJenkins job
● One repository containing the vagrantfile andOne repository containing the vagrantfile and
packer filepacker file
● Git/SVN commit hookGit/SVN commit hook
● Checkout by jenkinsCheckout by jenkins
● Shell script to execute packer provisioned onShell script to execute packer provisioned on
openstackopenstack
● Openstack image will be pushed to the cloud byOpenstack image will be pushed to the cloud by
packer automaticallypacker automatically
ContactContact
Jan Collijs jan.collijs@inuits.euJan Collijs jan.collijs@inuits.eu
Further ReadingFurther Reading
@visibilityspots@visibilityspots
https://visibilityspots.orghttps://visibilityspots.org
https://inuits.euhttps://inuits.eu
InuitsInuits
Essensteenweg 31Essensteenweg 31
BrasschaatBrasschaat
BelgiumBelgium
891.514.231891.514.231
+32 479 586488+32 479 586488

More Related Content

PDF
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
PPTX
Using Ansible Dynamic Inventory with Amazon EC2
PDF
Ansible - Swiss Army Knife Orchestration
PDF
Vagrant for real
PDF
DevOps(3) : Ansible - (MOSG)
PDF
Configuration Surgery with Augeas
PDF
Ansible - Introduction
PDF
Automation and Ansible
Dev ninja -> vagrant + virtualbox + chef-solo + git + ec2
Using Ansible Dynamic Inventory with Amazon EC2
Ansible - Swiss Army Knife Orchestration
Vagrant for real
DevOps(3) : Ansible - (MOSG)
Configuration Surgery with Augeas
Ansible - Introduction
Automation and Ansible

What's hot (17)

PDF
DevOps(4) : Ansible(2) - (MOSG)
PDF
Fabric workshop(1) - (MOSG)
PDF
Preparation study of_docker - (MOSG)
PDF
Ansible tips & tricks
PDF
Puppet fundamentals
PDF
DevOps(2) : Vagrant - (MOSG)
PDF
Ansible 實戰:top down 觀點
PDF
Automate with Ansible basic (2/e, English)
PDF
Making environment for_infrastructure_as_code
PDF
PuppetCamp SEA 1 - Use of Puppet
PDF
PuppetCamp SEA 1 - Puppet Deployment at OnApp
PDF
Start using vagrant now!
PDF
Shared Object images in Docker: What you need is what you want.
PDF
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
PDF
More tips n tricks
PPTX
Environments line-up! Vagrant & Puppet 101
PDF
Puppet at Opera Sofware - PuppetCamp Oslo 2013
DevOps(4) : Ansible(2) - (MOSG)
Fabric workshop(1) - (MOSG)
Preparation study of_docker - (MOSG)
Ansible tips & tricks
Puppet fundamentals
DevOps(2) : Vagrant - (MOSG)
Ansible 實戰:top down 觀點
Automate with Ansible basic (2/e, English)
Making environment for_infrastructure_as_code
PuppetCamp SEA 1 - Use of Puppet
PuppetCamp SEA 1 - Puppet Deployment at OnApp
Start using vagrant now!
Shared Object images in Docker: What you need is what you want.
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
More tips n tricks
Environments line-up! Vagrant & Puppet 101
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Ad

Similar to Automated reproducible images on openstack using vagrant and packer (20)

PDF
How I hack on puppet modules
PDF
From Dev to DevOps - Codemotion ES 2012
PDF
Provisioning with Puppet
KEY
From Dev to DevOps - ApacheCON NA 2011
PDF
From Dev to DevOps
PPTX
Virtualization and automation of library software/machines + Puppet
PDF
Puppet getting started by Dirk Götz
PDF
Puppet: Eclipsecon ALM 2013
KEY
From Dev to DevOps - FOSDEM 2012
PDF
Create your very own Development Environment with Vagrant and Packer
PDF
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PDF
Using Vagrant, Puppet, Testing & Hadoop
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PPTX
Webinar - Managing Files with Puppet
PDF
OlinData Puppet Presentation for MOSC 2012
PDF
OlinData Puppet Presentation for MOSC 2012
ODP
Puppet and the HashiCorp Suite
KEY
Puppet for Java developers - JavaZone NO 2012
PDF
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
How I hack on puppet modules
From Dev to DevOps - Codemotion ES 2012
Provisioning with Puppet
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps
Virtualization and automation of library software/machines + Puppet
Puppet getting started by Dirk Götz
Puppet: Eclipsecon ALM 2013
From Dev to DevOps - FOSDEM 2012
Create your very own Development Environment with Vagrant and Packer
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Webinar - Managing Files with Puppet
OlinData Puppet Presentation for MOSC 2012
OlinData Puppet Presentation for MOSC 2012
Puppet and the HashiCorp Suite
Puppet for Java developers - JavaZone NO 2012
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Ad

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
Teaching material agriculture food technology
PDF
cuic standard and advanced reporting.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Electronic commerce courselecture one. Pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Empathic Computing: Creating Shared Understanding
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Teaching material agriculture food technology
cuic standard and advanced reporting.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Advanced methodologies resolving dimensionality complications for autism neur...
Electronic commerce courselecture one. Pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
NewMind AI Monthly Chronicles - July 2025
Network Security Unit 5.pdf for BCA BBA.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Empathic Computing: Creating Shared Understanding
Dropbox Q2 2025 Financial Results & Investor Presentation
Digital-Transformation-Roadmap-for-Companies.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars

Automated reproducible images on openstack using vagrant and packer

  • 2. Jan CollijsJan Collijs ● Linux & Open-Source enthousiastLinux & Open-Source enthousiast ● Made my hobby my profession 5 years agoMade my hobby my profession 5 years ago @inuits@inuits ● Want to drink cocktails at the beach whileWant to drink cocktails at the beach while everything is automatedeverything is automated
  • 3. Use caseUse case ● Automated test suite using some CPE/CSAutomated test suite using some CPE/CS (centos) devices(centos) devices ● Used to be a serverpark maintained by puppetUsed to be a serverpark maintained by puppet ● Want a more flexible way of using resourcesWant a more flexible way of using resources ● ReproducibleReproducible ● FastFast
  • 6. VagrantVagrant ● Development Environments Made EasyDevelopment Environments Made Easy ● Local environment based on puppetLocal environment based on puppet ● Using vagrant-lxc containers or virtualboxUsing vagrant-lxc containers or virtualbox – https://github.com/visibilityspots/vagrant-puppethttps://github.com/visibilityspots/vagrant-puppet ● ServerspecServerspec – http://serverspec.orghttp://serverspec.org – With Serverspec, you can write RSpec testsWith Serverspec, you can write RSpec tests for checking your servers are configuredfor checking your servers are configured correctly.correctly.
  • 7. VagrantfileVagrantfileVAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision "shell", inline: "true" config.vm.provider :virtualbox do |virtualbox, override| override.vm.box = "vStone/centos-6.x-puppet.3.x" end config.vm.provider :lxc do |lxc, override| override.vm.box = "visibilityspots/centos-6.x-puppet-3.x" end config.vm.define :cpe do |cpe| cpe.vm.host_name = "cpe" cpe.vm.synced_folder "hieradata", "/etc/hiera" ext_env = ENV['VAGRANT_PUPPET_ENV'] ext_env = 'development' env = ext_env ? ext_env : config_env cpe.vm.synced_folder "puppet/environments/#{env}/modules", "/etc/puppet/environments/#{env}/modules" cpe.vm.synced_folder "spec/", "/tmp/tests" cpe.vm.provision :puppet do |puppet| puppet.options = "--environment #{env}" puppet.hiera_config_path = "hieradata/hiera.yaml" puppet.manifests_path = "puppet/environments/#{env}/manifests" puppet.manifest_file = "" puppet.module_path = "puppet/environments/#{env}/modules" end end end
  • 8. require 'vagrant-openstack-provider' VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provision "shell", inline: "true" if Vagrant.has_plugin?("vagrant-cachier") config.cache.scope = :box end config.vm.provider :virtualbox do |virtualbox, override| override.vm.box = "vStone/centos-6.x-puppet.3.x" end config.vm.provider :lxc do |lxc, override| override.vm.box = "visibilityspots/centos-6.x-puppet-3.x" end config.vm.provider :openstack do|os, override| override.nfs.functional = false override.ssh.pty = true override.ssh.username = "root" os.flavor = "m1.small" os.image = "centos-base-image" os.availability_zone = "default" os.security_groups = ['default'] os.openstack_auth_url = "http://#.#.#.#/v2.0/tokens" os.tenant_name = "tenant" os.keypair_name = "tenant" os.username = "centos" os.password = "password" override.ssh.private_key_path = "/path/to/ssh/key" os.networks = [ 'net-tenant', ] end config.vm.define :cpe do |cpe| cpe.vm.host_name = "cpe" cpe.vm.synced_folder "hieradata", "/etc/hiera" ext_env = ENV['VAGRANT_PUPPET_ENV'] ext_env = 'development' env = ext_env ? ext_env : config_env cpe.vm.synced_folder "puppet/environments/#{env}/modules", "/etc/puppet/environments/#{env}/modules" cpe.vm.synced_folder "spec/", "/tmp/tests" cpe.vm.provision :puppet do |puppet| puppet.options = "--environment #{env}" puppet.hiera_config_path = "hieradata/hiera.yaml" puppet.manifests_path = "puppet/environments/#{env}/manifests" puppet.manifest_file = "" puppet.module_path = "puppet/environments/#{env}/modules" end end end
  • 9. Packer.ioPacker.io ● Build Automated Machine ImagesBuild Automated Machine Images ● Using puppetUsing puppet ● Based on a centos minimal with kickstart in initialBased on a centos minimal with kickstart in initial phasephase ● ServerspecServerspec – With Serverspec, you can write RSpec testsWith Serverspec, you can write RSpec tests for checking your servers are configuredfor checking your servers are configured correctly.correctly. ● Based on a centos cloud based imageBased on a centos cloud based image – https://wiki.centos.org/Cloudhttps://wiki.centos.org/Cloud
  • 10. PackerfilePackerfile { "provisioners": [ { "type": "file", "source": "hieradata", "destination": "/tmp" }, { "type": "file", "source": "tests", "destination": "/tmp" }, { "type": "shell", "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash '{{.Path}}'", "scripts": [ "scripts/installrepos.sh", "scripts/initialize.sh", "scripts/installrvm.sh", "scripts/installserverspec.sh" ] }, { "type": "puppet-masterless", "manifest_file": "puppet/environments/production/manifests/", "hiera_config_path": "hieradata/hiera.yaml", "module_paths": "puppet/environments/production/modules/" }, { "type": "shell", "execute_command": "echo 'packer' | {{.Vars}} sudo -S -E bash '{{.Path}}'", "scripts": [ "scripts/serverspec.sh", "scripts/cleanup.sh", "scripts/zerodisk.sh" ] } ], "builders": [ { "availability_zone": "nova", "type": "openstack", "ssh_username": "username", "tenant_name": "tenant", "region": "RegionOne", "image_name": "cpe", "source_image": "####", "flavor": "cpe.tiny", "networks": ["####"], "ssh_pty" : true } ] }
  • 11. JenkinsJenkins ● The leading open source automation server,The leading open source automation server, Jenkins provides hundreds of plugins to supportJenkins provides hundreds of plugins to support building, deploying and automating any project.building, deploying and automating any project. ● https://jenkins.iohttps://jenkins.io
  • 12. Jenkins jobJenkins job ● One repository containing the vagrantfile andOne repository containing the vagrantfile and packer filepacker file ● Git/SVN commit hookGit/SVN commit hook ● Checkout by jenkinsCheckout by jenkins ● Shell script to execute packer provisioned onShell script to execute packer provisioned on openstackopenstack ● Openstack image will be pushed to the cloud byOpenstack image will be pushed to the cloud by packer automaticallypacker automatically
  • 13. ContactContact Jan Collijs jan.collijs@inuits.euJan Collijs jan.collijs@inuits.eu Further ReadingFurther Reading @visibilityspots@visibilityspots https://visibilityspots.orghttps://visibilityspots.org https://inuits.euhttps://inuits.eu InuitsInuits Essensteenweg 31Essensteenweg 31 BrasschaatBrasschaat BelgiumBelgium 891.514.231891.514.231 +32 479 586488+32 479 586488