Closed nfloersch closed 8 years ago
If I only had a wish for one Christmas miracle...
This is a feature our organization would very much appreciate if it existed.
The majority of the work that's done on this project is aimed at installing Windows from an ISO. When you use packer on an AWS Windows image, you already get an installed version that has the latest OS patches, which makes ~80% of the work this project performs unnecessary. The extra 20% are kind of just a collection of extras that can be added in (chocolatey) and minor optimizations for the purpose of vagrant itself (defrag disk)
I don't think this project really aims at doing much work starting from cloud based images. The biggest hurdle for packer to get past before it can really start to communicate with AWS / Azure Windows images is WinRM support. Currently this is available with a community plugin (https://github.com/packer-community/packer-windows-plugins) and your best bet would be to start looking over there.
Actually this is probably a good step in the right direction for this project to remove the dependency on SSH so we might be able to include AWS/Azure as another build target in the future.
I've been working on this still. I've created an altered version of this project's Win2k12R2 sysprep unattend.xml file that is merged with the defaults provided by Amazon's Win2k12R2 base AMI. I then created a powershell script that I can use for the user data.
My only hiccups in automation are...
Still, it appears that if I could figure out the certificates thing, at least, Packer would be able to lead a new instance through the full setup, even though most of that is triggered by powershell in the user data.
My goal all along has been to be able to build EC2 instances that are as close as possible to our development VMs running on the developer's laptop/desktop. Obvious stuff... but it would be so much easier if my devs used Linux or Mac/BSD. Scripting this Windows stuff is always an interesting challenge, but sometimes you just want to get some development work done! :^)
I'm sure the WinRM plugin will be awesome for me eventually... but knowing nothing about WinRM, I haven't minded in theory still using SSH on Windows. It is also useful to have SSH on the Windows servers so I can integrate other automation with our servers such as the SSH hooks from our Assembla projects.
The approach we're looking at taking right now is spinning up Windows Server EC2 instances via CloudFormation, doing some up-front configuration that way and then making a snapshot from that.
The AMI created from that will be used in other CFN template to actually build stacks.
With Linux, I prep AWS base CentOS and Ubuntu AMIs using Packer and then we use the resultant AMIs in CFN templates or create more AMIs with more Packer scripts.
Yeah I guess I just wanted to avoid making my own AMIs for Windows because I like the Packer ideal so much ... one generic machine description JSON that ends up realized in EC2, in Vagrant, wherever. It sounds cool, but we aren't quite there yet for Windows it seems :^\
Your CFN setup sounds like you have a much more complex set of server needs than I do! It also sounds pretty cool! Maybe at some point I'll have a better reason to delve into CFN.
@nfloersch Yeah the CFN aspect of it is for building out full stacks, but it all starts with the basic AMI which is what we were looking to this project to help with. @kensykora does mention https://github.com/packer-community/packer-windows-plugins which does have an EC2-EBS builder for Windows
@nfloersch I think what you're asking for is definitely possible to a degree, but your ideal to a have a "Generic" machine description JSON isn't -- primarily because of the core reason that you can't install Windows from an ISO on AWS. Even in your packer .json file, you will have 2 separate blocks for AWS buidler and for a vmware-iso builder. They'll look similar but won't be exactly the same.
I for one am fine with the idea that this packer-windows project gets us to the baseline level for Vagrant while a baseline level for AWS is already maintained by Amazon.
I think of it like this:
{
[packer-windows project] -> Baseline Windows Vagrant Box
}
->
{
[Vagrant Box] -> Baseline windows vagrant box
[AWS] -> Baseline AWS Windows Server Image
}
->
{
[Vagrant Box] -> Apply Manifests / Scripts
[AWS Instance] -> Apply Manifests / Scripts
}
->
{
Application specific vagrant box
Application specific AWS image
}
The two will always be synced up, but in parallel and never truly be completely equal because they'll be starting from separate points in time. For instance, AWS might be Windows Server 2012 Data Center edition, and Vagrant might be Server 2012 Standard. Very minor but important to remember.
Packer-windows doesn't support AWS.
Perhaps in the future it will once:
For now you can use Packer directly to do what you need. Here's a blog post I wrote about creating a Windows AMI using Packer.
Is this idea any closer to reality today in 2019?
Just adding an amazon-ebs section to my packer JSON file that uses the same scripts and such for the VMWare builder does not work - obviously. But it is not obvious what path one takes to simultaneously build a Windows Vagrant box and EC2 machine with Packer? While it is not explicitly stated on the project page here it appears that all of this awesome work done to get Windows working well with Packer is only for using VMware or VirtualBox with a final target of running in Vagrant. Has anyone used the work done in this GitHub project to deploy to EC2 as well?