BUILDING AN IMAGE BAKERYWITH PACKER.IO
Ricard Clau - London WinOps - February 2016
PROBLEMS TRIED TO SOLVE• Need to automate creation of servers both
Windows (2008 & 2012) and Linux (mostly Ubuntu 14.04)
• Hybrid infrastructure AWS / Datacenter
• Provisioning tools work well but a reliable and reproducible common initial state is useful
WHAT IS PACKER?
EXTRA BENEFITS• Massive boost at spinning servers
• Easy to share provisioning scripts
• Easier to understand than Chef / Puppet / Ansible (different domain)
• Works on Windows, Mac and Linux!
• Significantly reduce manual patching
NO MORE PATCHING???• You should create stateless applications so that
replacing servers by patched ones is not an issue
• Subscribe to these 2 AWS SNS topics:• arn:aws:sns:us-east-1:801119661308:ec2-windows-ami-update• arn:aws:sns:us-east-1:801119661308:ec2-windows-ami-private
• In VMWare, you can start from updated ISOs or other existing VMWare machines
AWS EBS BUILDER• Start from an existing patched AMI
• Initial userdata to allow WinRM and remote PS
• Packer can retrieve the random Admin password!
• Provision your box (and tag your final AMI)
• Sysprep to allow new userdata in EC2 instances
AWS EBS OUTPUT
AWS EBS OUTPUT (II)
VMWARE BUILDER (I)• Start from an ISO or an existing VMWare box
• autounattend.xml files to automate installation, Administrator password, initial PowerShell and WinRM config, Power plan…
• You can add other initial provisioning scripts (before 1st reboot) in the floppy_files array
VMWARE BUILDER (II)• You need to install VMWare Fusion (MacOSx)
or Workstation (Linux / Windows)
• disk_type_id for different VMDK options
• After reboot, you can use the same provisioners we had in the AWS builder
VMWARE FUSION WORKING
WONGA BAKERY MODELAutomation
Team
Development Team
STILL ITERATING• Feedback from different dev teams
• Spawn scripts / more automation around the bakery
• Add some CI/CD tools around it
• Using generated AMIs / VMWare boxes in a Terraform setup
• Trying to find out the best way to generate and use the VMWare images in the datacenter
GIVE PACKER A TRY!• Before 2016, I had never written any PS
• I had never used Packer before either
• In fact, I did not even know all this was possible!
• We produced working images in a week spike!
SPECIAL THANKS• Mitchell Hashimoto for building Packer and the
rest of the HashiCorp stack
• Andrew Hardie for his talk “Don't go Packer in anger” at London DevOps last October
• Peter Mounce for sharing his experiences automating Windows at Just Eat
BTW… INCIDENTALLY• We are hiring, like everybody else :)
• Does the HashiCorp toolset sound interesting?
• Do you like automating all-the-things?
• Do you want to work with us in these offices?
QUESTIONS?• Twitter: @ricardclau
• E-mail: [email protected]
• Github: https://github.com/ricardclau/packer-demos