SlideShare a Scribd company logo
1 of 25
Download to read offline
https://youtu.be/aJzA-e_3tDA
https://github.com/bbaassssiiee/vagransible
@bbaassssiiee
Bas MeijerDevOps Lead, Schiphol Amsterdam Airport
Wasted decades on late-night hacking
@bbaassssiiee
@bbaassssiiee
@bbaassssiiee
Image Building
@bbaassssiiee
Packer Vagrant
Vagrant fakes IT, until IT makes it!
• Simple idea, but very powerful
• VM`s on laptop model the production environment
• Reproducible Workflows
• Automation with Vagrant
@bbaassssiiee
Vagrant
Automate VM workflows
•Vagrantfile in top-level directory
•CLI interface
•Various options
•Multiple VMs
•Multiple Hypervisors
•Virtualbox - VMWare - KVM
@bbaassssiiee
Vagrant.configure("2") do |config|
config.vm.define :linux, primary: true,do |linux|
linux.vm.box = "centos/7"
linux.vm.box_version = "1710.01"
linux.vm.hostname = "linux.test"
linux.vm.boot_timeout = 900
linux.vm.synced_folder ".", "/vagrant"
linux.vm.network "private_network",
ip: “192.168.1.234",
:netmask => “255.255.255.0"
linux.vm.network "forwarded_port",
id: 'ssh', guest: 22,
host: 2222, auto_correct: false
end
end
Vagrantfile
@bbaassssiiee
...
config.vbguest.auto_update = false
config.ssh.forward_agent = false
config.ssh.insert_key = false
config.vm.graceful_halt_timeout=30
linux.vm.provider "virtualbox" do |vb|
vb.customize [
"modifyvm", :id,
"--natdnshostresolver1", "on",
"--cableconnected1", "on",
]
vb.gui = false
vb.name = "linux.test"
end
end
Options
@bbaassssiiee
linux.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "playbook.yml"
ansible.skip_tags = "deploy"
ansible.galaxy_role_file = "requirements.yml"
ansible.galaxy_roles_path = "galaxy_roles"
ansible.verbose = “vv"
end
Ansible provisioning
@bbaassssiiee
Terminal
$ vagrant up
$ vagrant ssh
$ vagrant suspend
$ vagrant destroy -f
$ vagrant up
$ vagrant halt
Packer
VM`s hide problems with
hardware
Clouds: other people’s hypervisors
Each cloud has its own problems
@bbaassssiiee
Packer
@bbaassssiiee
Azure VMWare
AWS DigitalOcean
ESX Google
HYPER-V OpenStack
CloudStack VirtualBox
Packer has Builders!
@bbaassssiiee
Vagrant VM Image Workflow
Packer
Ansible
Bash
Chef
Puppet
Provisioner agnostic
@bbaassssiiee
Packer
@bbaassssiiee
Packer
Vagrant
Ansible
Access to cloud
Patience
What do you need?
What does Azure need?
subscription_id
client_id
tenant_id
resource_group
storage_account
client_secret
@bbaassssiiee
Azure
Azure VM Image Workflow
@bbaassssiiee
{
"boot_command": [
"<tab> append initrd=initrd.img inst.text inst.ks=http://
{{ .HTTPIP }}:{{ .HTTPPort }}/centos7.ks<enter><wait>"
],
"boot_wait": "20s",
"guest_additions_path": "VBoxGuestAdditions.iso",
"guest_os_type": "RedHat_64",
"headless": false,
"http_directory": "kickstart",
"iso_checksum":
"27bd866242ee058b7a5754e83d8ee8403e216b93d130d800852a96f41c34d86a",
"iso_checksum_type": "sha256",
"iso_urls": [
"file:///Users/Shared/CentOS-7-x86_64-Minimal-1611.iso",
],
"output_directory": "output-virtualbox-iso",
"shutdown_command": "echo 'vagrant' | sudo -S /sbin/shutdown -h 0",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_username": "root",
"ssh_wait_timeout": "10000s",
"type": "virtualbox-iso",
"virtualbox_version_file": ".vbox_version",
"vm_name": "dockpack/centos7"
}
VirtualBox Builder
@bbaassssiiee
"provisioners": [
{
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash
'{{.Path}}'",
"scripts": [
"scripts/vagrant.sh",
"scripts/vmtools.sh"
],
"type": "shell"
},{
"playbook_file": "ansible/packer.yml",
"role_paths": [
"ansible/roles/dockpack.base_docker",
"ansible/roles/dockpack.base_java8"
],
"type": "ansible-local"
},
{
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash
'{{.Path}}'",
"only": [
"vmware-iso"
],
"script": "scripts/cleanup.sh",
"type": "shell"
}
]
Provisioning with DOCKPACK Ansible Roles
@bbaassssiiee
{
"azure_tags": {
"environment": "{{user `env`}}",
"organization": "snbv",
"product": "centos7image"
},
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"image_offer": "CentOS",
"image_publisher": "OpenLogic",
"image_sku": "7.3",
"location": "West Europe",
"managed_image_name": "centos7",
"managed_image_resource_group_name": "{{user `resource_group`}}",
"os_type": "Linux",
"subscription_id": "{{user `subscription_id`}}",
"tenant_id": "{{user `tenant_id`}}",
"type": "azure-arm",
"vm_size": "Standard_DS2_v2"
}
Azure Builder
@bbaassssiiee
"provisioners": [
{
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash
'{{.Path}}'",
"scripts": [
"scripts/ansible.sh"
],
"type": "shell"
},{
"playbook_file": "ansible/packer.yml",
"role_paths": [
"ansible/roles/dockpack.base_docker",
"ansible/roles/dockpack.base_java8"
],
"type": "ansible-local"
},{
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh
'{{ .Path }}'",
"inline": [
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0
&& sync"
],
"inline_shebang": "/bin/sh -x”,
"type": "shell"
}
]
Provisioning with DOCKPACK Ansible Roles
@bbaassssiiee
Azure
az vm create 

--resource-group my-demo-lab 
--name my-demo-vm 

--image my-centos7-image 
--admin-username bbaassssiiee 
--generate-ssh-keys
@bbaassssiiee
Using the VM image
resource "azurerm_virtual_machine" "virtual_machine" {
count = "${var.machine_count}"
name = "${local.machine_identifier}-${count.index +
1}"
location = "$
{azurerm_resource_group.resource_group.location}"
resource_group_name = "$
{azurerm_resource_group.resource_group.name}"
vm_size = "${var.machine_size}"
network_interface_ids = ["$
{element(azurerm_network_interface.network_interface.*.id,
count.index)}"]
os_profile_linux_config {
disable_password_authentication = true
ssh_keys {
key_data = "${file("${var.ssh_key_path}")}"
path = "/home/${var.admin_username}/.ssh/authorized_keys"
}
}
storage_os_disk {
name = "${local.machine_identifier}-osdisk1"
image_uri = "https://myinfratmp.blob.core.windows.net/system/
Microsoft.Compute/Images/images/packer-osDisk.850f2a37-a2eb-491e-
ab8c-0f8282b4f97e.vhd"
vhd_uri = "https://$
{azurerm_storage_account.storage_account.name}.blob.core.windows.net/
vhds/${local.machine_identifier}-osdisk.vhd"
os_type = "Linux"
caching = "ReadWrite"
create_option = "FromImage"
}
Terraform
https://youtu.be/aJzA-e_3tDA
https://github.com/bbaassssiiee/vagransible
@bbaassssiiee

More Related Content

What's hot

Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-OverviewCrifkin
 
Building with Virtual Development Environments
Building with Virtual Development EnvironmentsBuilding with Virtual Development Environments
Building with Virtual Development EnvironmentsOscar Merida
 
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreChef Software, Inc.
 
Building with Virtual Development Environments
Building with Virtual Development EnvironmentsBuilding with Virtual Development Environments
Building with Virtual Development EnvironmentsOscar Merida
 
Advanced front-end automation with npm scripts
Advanced front-end automation with npm scriptsAdvanced front-end automation with npm scripts
Advanced front-end automation with npm scriptsk88hudson
 
Deploying to Ubuntu on Linode
Deploying to Ubuntu on LinodeDeploying to Ubuntu on Linode
Deploying to Ubuntu on LinodeWO Community
 
Javascript Bundling and modularization
Javascript Bundling and modularizationJavascript Bundling and modularization
Javascript Bundling and modularizationstbaechler
 
Augeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet treeAugeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet treeJulien Pivotto
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentTakayuki Miyauchi
 
Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Kite Koga
 
Charm City Linux - Jan 2014 - Web Dev Made Easy - Shell Revolution
Charm City Linux - Jan 2014 - Web Dev Made Easy - Shell RevolutionCharm City Linux - Jan 2014 - Web Dev Made Easy - Shell Revolution
Charm City Linux - Jan 2014 - Web Dev Made Easy - Shell RevolutionChris Stone
 
System webpack-jspm
System webpack-jspmSystem webpack-jspm
System webpack-jspmJesse Warden
 
Windows Subsystem for Linux .NET Oxford Dec 2018
Windows Subsystem for Linux .NET Oxford Dec 2018Windows Subsystem for Linux .NET Oxford Dec 2018
Windows Subsystem for Linux .NET Oxford Dec 2018Stuart Leeks
 

What's hot (20)

Vagrant-Overview
Vagrant-OverviewVagrant-Overview
Vagrant-Overview
 
Building with Virtual Development Environments
Building with Virtual Development EnvironmentsBuilding with Virtual Development Environments
Building with Virtual Development Environments
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
Vagrant
VagrantVagrant
Vagrant
 
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
 
Node.js debugging
Node.js debuggingNode.js debugging
Node.js debugging
 
Building with Virtual Development Environments
Building with Virtual Development EnvironmentsBuilding with Virtual Development Environments
Building with Virtual Development Environments
 
Vagrant
Vagrant Vagrant
Vagrant
 
Advanced front-end automation with npm scripts
Advanced front-end automation with npm scriptsAdvanced front-end automation with npm scripts
Advanced front-end automation with npm scripts
 
Deploying to Ubuntu on Linode
Deploying to Ubuntu on LinodeDeploying to Ubuntu on Linode
Deploying to Ubuntu on Linode
 
BitTorrent on iOS
BitTorrent on iOSBitTorrent on iOS
BitTorrent on iOS
 
Javascript Bundling and modularization
Javascript Bundling and modularizationJavascript Bundling and modularization
Javascript Bundling and modularization
 
Augeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet treeAugeas, swiss knife resources for your puppet tree
Augeas, swiss knife resources for your puppet tree
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environment
 
Aloofix
AloofixAloofix
Aloofix
 
Vagrant and CentOS 7
Vagrant and CentOS 7Vagrant and CentOS 7
Vagrant and CentOS 7
 
Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41Wocker @WordBench Osaka No.41
Wocker @WordBench Osaka No.41
 
Charm City Linux - Jan 2014 - Web Dev Made Easy - Shell Revolution
Charm City Linux - Jan 2014 - Web Dev Made Easy - Shell RevolutionCharm City Linux - Jan 2014 - Web Dev Made Easy - Shell Revolution
Charm City Linux - Jan 2014 - Web Dev Made Easy - Shell Revolution
 
System webpack-jspm
System webpack-jspmSystem webpack-jspm
System webpack-jspm
 
Windows Subsystem for Linux .NET Oxford Dec 2018
Windows Subsystem for Linux .NET Oxford Dec 2018Windows Subsystem for Linux .NET Oxford Dec 2018
Windows Subsystem for Linux .NET Oxford Dec 2018
 

Similar to Azure VM base images with Packer, Ansble and Vagrant

OpenSource ToolChain for the Hybrid Cloud
OpenSource ToolChain for the Hybrid CloudOpenSource ToolChain for the Hybrid Cloud
OpenSource ToolChain for the Hybrid CloudIsaac Christoffersen
 
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
 
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
 
Modern tooling to assist with developing applications on FreeBSD
Modern tooling to assist with developing applications on FreeBSDModern tooling to assist with developing applications on FreeBSD
Modern tooling to assist with developing applications on FreeBSDSean Chittenden
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardwayDave Pitts
 
Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Dmitry Guyvoronsky
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefMatt Ray
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de VagrantLeandro Nunes
 
Przemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy Terraform
Przemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy TerraformPrzemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy Terraform
Przemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy Terraformjzielinski_pl
 
Making Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerMaking Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerJohn Rofrano
 
Packer, where DevOps begins
Packer, where DevOps beginsPacker, where DevOps begins
Packer, where DevOps beginsJeff Hung
 
The Neova Health Open Source Tool Chain
The Neova Health  Open Source Tool ChainThe Neova Health  Open Source Tool Chain
The Neova Health Open Source Tool ChainRob Dyke
 
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
 
Windows Azure loves OSS
Windows Azure loves OSSWindows Azure loves OSS
Windows Azure loves OSSKazumi Hirose
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantBrian Hogan
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Automating Container Deployments on Virtualization with Ansible: OpenShift on...
Automating Container Deployments on Virtualization with Ansible: OpenShift on...Automating Container Deployments on Virtualization with Ansible: OpenShift on...
Automating Container Deployments on Virtualization with Ansible: OpenShift on...Laurent Domb
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStackPuppet
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzerDmitry Vyukov
 

Similar to Azure VM base images with Packer, Ansble and Vagrant (20)

OpenSource ToolChain for the Hybrid Cloud
OpenSource ToolChain for the Hybrid CloudOpenSource ToolChain for the Hybrid Cloud
OpenSource ToolChain for the Hybrid Cloud
 
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...
 
Vagrant For DevOps
Vagrant For DevOpsVagrant For DevOps
Vagrant For DevOps
 
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
 
Modern tooling to assist with developing applications on FreeBSD
Modern tooling to assist with developing applications on FreeBSDModern tooling to assist with developing applications on FreeBSD
Modern tooling to assist with developing applications on FreeBSD
 
Postgres the hardway
Postgres the hardwayPostgres the hardway
Postgres the hardway
 
Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)Virtualization with Vagrant (ua.pycon 2011)
Virtualization with Vagrant (ua.pycon 2011)
 
Bare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and ChefBare Metal to OpenStack with Razor and Chef
Bare Metal to OpenStack with Razor and Chef
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de Vagrant
 
Przemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy Terraform
Przemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy TerraformPrzemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy Terraform
Przemysław Iwanek - ABC AWS, budowanie infrastruktury przy pomocy Terraform
 
Making Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerMaking Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and Docker
 
Packer, where DevOps begins
Packer, where DevOps beginsPacker, where DevOps begins
Packer, where DevOps begins
 
The Neova Health Open Source Tool Chain
The Neova Health  Open Source Tool ChainThe Neova Health  Open Source Tool Chain
The Neova Health Open Source Tool Chain
 
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
 
Windows Azure loves OSS
Windows Azure loves OSSWindows Azure loves OSS
Windows Azure loves OSS
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Automating Container Deployments on Virtualization with Ansible: OpenShift on...
Automating Container Deployments on Virtualization with Ansible: OpenShift on...Automating Container Deployments on Virtualization with Ansible: OpenShift on...
Automating Container Deployments on Virtualization with Ansible: OpenShift on...
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzer
 

More from Bas Meijer

Keybase Vault Auto-Unseal HashiTalks2020
Keybase Vault Auto-Unseal HashiTalks2020Keybase Vault Auto-Unseal HashiTalks2020
Keybase Vault Auto-Unseal HashiTalks2020Bas Meijer
 
Ansible at work
Ansible at workAnsible at work
Ansible at workBas Meijer
 
Help! My app is being featured.
Help! My app is being featured.Help! My app is being featured.
Help! My app is being featured.Bas Meijer
 
Testing with Ansible
Testing with AnsibleTesting with Ansible
Testing with AnsibleBas Meijer
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practicesBas Meijer
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with AnsibleBas Meijer
 
Fake IT, until you make IT
Fake IT, until you make ITFake IT, until you make IT
Fake IT, until you make ITBas Meijer
 

More from Bas Meijer (8)

Keybase Vault Auto-Unseal HashiTalks2020
Keybase Vault Auto-Unseal HashiTalks2020Keybase Vault Auto-Unseal HashiTalks2020
Keybase Vault Auto-Unseal HashiTalks2020
 
Packer demo
Packer demoPacker demo
Packer demo
 
Ansible at work
Ansible at workAnsible at work
Ansible at work
 
Help! My app is being featured.
Help! My app is being featured.Help! My app is being featured.
Help! My app is being featured.
 
Testing with Ansible
Testing with AnsibleTesting with Ansible
Testing with Ansible
 
Ansible, best practices
Ansible, best practicesAnsible, best practices
Ansible, best practices
 
docker build with Ansible
docker build with Ansibledocker build with Ansible
docker build with Ansible
 
Fake IT, until you make IT
Fake IT, until you make ITFake IT, until you make IT
Fake IT, until you make IT
 

Recently uploaded

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 

Azure VM base images with Packer, Ansble and Vagrant

  • 2. Bas MeijerDevOps Lead, Schiphol Amsterdam Airport Wasted decades on late-night hacking @bbaassssiiee
  • 6. Vagrant fakes IT, until IT makes it! • Simple idea, but very powerful • VM`s on laptop model the production environment • Reproducible Workflows • Automation with Vagrant @bbaassssiiee
  • 7. Vagrant Automate VM workflows •Vagrantfile in top-level directory •CLI interface •Various options •Multiple VMs •Multiple Hypervisors •Virtualbox - VMWare - KVM @bbaassssiiee
  • 8. Vagrant.configure("2") do |config| config.vm.define :linux, primary: true,do |linux| linux.vm.box = "centos/7" linux.vm.box_version = "1710.01" linux.vm.hostname = "linux.test" linux.vm.boot_timeout = 900 linux.vm.synced_folder ".", "/vagrant" linux.vm.network "private_network", ip: “192.168.1.234", :netmask => “255.255.255.0" linux.vm.network "forwarded_port", id: 'ssh', guest: 22, host: 2222, auto_correct: false end end Vagrantfile @bbaassssiiee
  • 9. ... config.vbguest.auto_update = false config.ssh.forward_agent = false config.ssh.insert_key = false config.vm.graceful_halt_timeout=30 linux.vm.provider "virtualbox" do |vb| vb.customize [ "modifyvm", :id, "--natdnshostresolver1", "on", "--cableconnected1", "on", ] vb.gui = false vb.name = "linux.test" end end Options @bbaassssiiee
  • 10. linux.vm.provision "ansible" do |ansible| ansible.compatibility_mode = "2.0" ansible.playbook = "playbook.yml" ansible.skip_tags = "deploy" ansible.galaxy_role_file = "requirements.yml" ansible.galaxy_roles_path = "galaxy_roles" ansible.verbose = “vv" end Ansible provisioning @bbaassssiiee
  • 11. Terminal $ vagrant up $ vagrant ssh $ vagrant suspend $ vagrant destroy -f $ vagrant up $ vagrant halt
  • 12. Packer VM`s hide problems with hardware Clouds: other people’s hypervisors Each cloud has its own problems @bbaassssiiee
  • 13. Packer @bbaassssiiee Azure VMWare AWS DigitalOcean ESX Google HYPER-V OpenStack CloudStack VirtualBox Packer has Builders!
  • 17. What does Azure need? subscription_id client_id tenant_id resource_group storage_account client_secret @bbaassssiiee Azure
  • 18. Azure VM Image Workflow @bbaassssiiee
  • 19. { "boot_command": [ "<tab> append initrd=initrd.img inst.text inst.ks=http:// {{ .HTTPIP }}:{{ .HTTPPort }}/centos7.ks<enter><wait>" ], "boot_wait": "20s", "guest_additions_path": "VBoxGuestAdditions.iso", "guest_os_type": "RedHat_64", "headless": false, "http_directory": "kickstart", "iso_checksum": "27bd866242ee058b7a5754e83d8ee8403e216b93d130d800852a96f41c34d86a", "iso_checksum_type": "sha256", "iso_urls": [ "file:///Users/Shared/CentOS-7-x86_64-Minimal-1611.iso", ], "output_directory": "output-virtualbox-iso", "shutdown_command": "echo 'vagrant' | sudo -S /sbin/shutdown -h 0", "ssh_password": "vagrant", "ssh_port": 22, "ssh_username": "root", "ssh_wait_timeout": "10000s", "type": "virtualbox-iso", "virtualbox_version_file": ".vbox_version", "vm_name": "dockpack/centos7" } VirtualBox Builder @bbaassssiiee
  • 20. "provisioners": [ { "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'", "scripts": [ "scripts/vagrant.sh", "scripts/vmtools.sh" ], "type": "shell" },{ "playbook_file": "ansible/packer.yml", "role_paths": [ "ansible/roles/dockpack.base_docker", "ansible/roles/dockpack.base_java8" ], "type": "ansible-local" }, { "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'", "only": [ "vmware-iso" ], "script": "scripts/cleanup.sh", "type": "shell" } ] Provisioning with DOCKPACK Ansible Roles @bbaassssiiee
  • 21. { "azure_tags": { "environment": "{{user `env`}}", "organization": "snbv", "product": "centos7image" }, "client_id": "{{user `client_id`}}", "client_secret": "{{user `client_secret`}}", "image_offer": "CentOS", "image_publisher": "OpenLogic", "image_sku": "7.3", "location": "West Europe", "managed_image_name": "centos7", "managed_image_resource_group_name": "{{user `resource_group`}}", "os_type": "Linux", "subscription_id": "{{user `subscription_id`}}", "tenant_id": "{{user `tenant_id`}}", "type": "azure-arm", "vm_size": "Standard_DS2_v2" } Azure Builder @bbaassssiiee
  • 22. "provisioners": [ { "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'", "scripts": [ "scripts/ansible.sh" ], "type": "shell" },{ "playbook_file": "ansible/packer.yml", "role_paths": [ "ansible/roles/dockpack.base_docker", "ansible/roles/dockpack.base_java8" ], "type": "ansible-local" },{ "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", "inline": [ "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" ], "inline_shebang": "/bin/sh -x”, "type": "shell" } ] Provisioning with DOCKPACK Ansible Roles @bbaassssiiee
  • 23. Azure az vm create 
 --resource-group my-demo-lab --name my-demo-vm 
 --image my-centos7-image --admin-username bbaassssiiee --generate-ssh-keys @bbaassssiiee Using the VM image
  • 24. resource "azurerm_virtual_machine" "virtual_machine" { count = "${var.machine_count}" name = "${local.machine_identifier}-${count.index + 1}" location = "$ {azurerm_resource_group.resource_group.location}" resource_group_name = "$ {azurerm_resource_group.resource_group.name}" vm_size = "${var.machine_size}" network_interface_ids = ["$ {element(azurerm_network_interface.network_interface.*.id, count.index)}"] os_profile_linux_config { disable_password_authentication = true ssh_keys { key_data = "${file("${var.ssh_key_path}")}" path = "/home/${var.admin_username}/.ssh/authorized_keys" } } storage_os_disk { name = "${local.machine_identifier}-osdisk1" image_uri = "https://myinfratmp.blob.core.windows.net/system/ Microsoft.Compute/Images/images/packer-osDisk.850f2a37-a2eb-491e- ab8c-0f8282b4f97e.vhd" vhd_uri = "https://$ {azurerm_storage_account.storage_account.name}.blob.core.windows.net/ vhds/${local.machine_identifier}-osdisk.vhd" os_type = "Linux" caching = "ReadWrite" create_option = "FromImage" } Terraform