building a bakery of windows servers with packer - london winops

17
BUILDING AN IMAGE BAKERY WITH PACKER.IO Ricard Clau - London WinOps - February 2016

Upload: ricard-clau

Post on 23-Jan-2017

999 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Building a bakery of Windows servers with Packer - London WinOps

BUILDING AN IMAGE BAKERYWITH PACKER.IO

Ricard Clau - London WinOps - February 2016

Page 2: Building a bakery of Windows servers with Packer - London WinOps

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

Page 3: Building a bakery of Windows servers with Packer - London WinOps

WHAT IS PACKER?

Page 4: Building a bakery of Windows servers with Packer - London WinOps

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

Page 5: Building a bakery of Windows servers with Packer - London WinOps

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

Page 6: Building a bakery of Windows servers with Packer - London WinOps

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

Page 7: Building a bakery of Windows servers with Packer - London WinOps

AWS EBS OUTPUT

Page 8: Building a bakery of Windows servers with Packer - London WinOps

AWS EBS OUTPUT (II)

Page 9: Building a bakery of Windows servers with Packer - London WinOps

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

Page 10: Building a bakery of Windows servers with Packer - London WinOps

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

Page 11: Building a bakery of Windows servers with Packer - London WinOps

VMWARE FUSION WORKING

Page 12: Building a bakery of Windows servers with Packer - London WinOps

WONGA BAKERY MODELAutomation

Team

Development Team

Page 13: Building a bakery of Windows servers with Packer - London WinOps

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

Page 14: Building a bakery of Windows servers with Packer - London WinOps

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!

Page 15: Building a bakery of Windows servers with Packer - London WinOps

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

Page 16: Building a bakery of Windows servers with Packer - London WinOps

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?

Page 17: Building a bakery of Windows servers with Packer - London WinOps

QUESTIONS?• Twitter: @ricardclau

• E-mail: [email protected]

• Github: https://github.com/ricardclau/packer-demos