diff --git a/README-ami.md b/README-ami.md index 7ff6d03a..710f07d1 100644 --- a/README-ami.md +++ b/README-ami.md @@ -9,3 +9,4 @@ the amazon import service https://docs.aws.amazon.com/vm-import/latest/userguide * Packer 1.2.3+. https://www.packer.io/downloads.html * S3 Bucket with the necessary permissions. Set the `AWS_S3_BUCKET` environment variable. * If you use SAML authentication make sure you set `profile` in the amazon-import post-processor. +* `vm-guest-tools` provisioner is removed. diff --git a/windows_2016_ami.json b/windows_2016_ami.json index 93eee819..d842efac 100644 --- a/windows_2016_ami.json +++ b/windows_2016_ami.json @@ -56,12 +56,13 @@ "access_key": "", "secret_key": "", "region": "", + "ami_name": "packer_windows_2016", "s3_bucket_name": "{{user `aws_s3_bucket_name`}}", "keep_input_artifact": false, "license_type": "BYOL", "tags": { - "Description": "packer-windows amazon-import {{timestamp}}" + "Description": "packer-windows 2016 amazon-import {{timestamp}}" } } ], @@ -69,7 +70,6 @@ { "execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"", "scripts": [ - "./scripts/vm-guest-tools.bat", "./scripts/enable-rdp.bat" ], "type": "windows-shell" diff --git a/windows_2016_core_ami.json b/windows_2016_core_ami.json new file mode 100644 index 00000000..8ab1aa65 --- /dev/null +++ b/windows_2016_core_ami.json @@ -0,0 +1,102 @@ +{ + "builders": [ + { + "boot_wait": "2m", + "communicator": "winrm", + "disk_size": "{{user `disk_size`}}", + "floppy_files": [ + "{{user `autounattend`}}", + "./scripts/disable-screensaver.ps1", + "./scripts/disable-winrm.ps1", + "./scripts/enable-winrm.ps1", + "./scripts/microsoft-updates.bat", + "./scripts/win-updates.ps1" + ], + "guest_additions_mode": "disable", + "guest_os_type": "Windows2016_64", + "headless": "{{user `headless`}}", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", + "format": "ova", + "type": "virtualbox-iso", + "vboxmanage": [ + [ + "modifyvm", + "{{.Name}}", + "--memory", + "2048" + ], + [ + "modifyvm", + "{{.Name}}", + "--cpus", + "2" + ] + ], + "winrm_password": "vagrant", + "winrm_timeout": "{{user `winrm_timeout`}}", + "winrm_username": "vagrant" + } + ], + "post-processors": [ + { + "keep_input_artifact": false, + "output": "windows_2016_core_{{.Provider}}.box", + "type": "vagrant", + "vagrantfile_template": "vagrantfile-windows_2016_core.template" + }, + { + "type": "amazon-import", + "only": ["virtualbox-iso"], + "access_key": "", + "secret_key": "", + "region": "", + "ami_name": "packer_windows_2016_core", + "s3_bucket_name": "{{user `aws_s3_bucket_name`}}", + "keep_input_artifact": false, + "license_type": "BYOL", + "tags": + { + "Description": "packer-windows 2016 core amazon-import {{timestamp}}" + } + } + ], + "provisioners": [ + { + "scripts": [ + "./scripts/enable-rdp.bat" + ], + "type": "windows-shell" + }, + { + "scripts": [ + "./scripts/debloat-windows.ps1" + ], + "type": "powershell" + }, + { + "scripts": [ + "./scripts/set-winrm-automatic.bat", + "./scripts/uac-enable.bat", + "./scripts/compile-dotnet-assemblies.bat", + "./scripts/dis-updates.bat", + "./scripts/compact.bat" + ], + "type": "windows-shell" + } + ], + "variables": { + "autounattend": "./answer_files/2016_core/Autounattend.xml", + "disk_size": "61440", + "disk_type_id": "1", + "headless": "false", + "iso_checksum": "70721288BBCDFE3239D8F8C0FAE55F1F", + "iso_checksum_type": "md5", + "iso_url": "https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO", + "winrm_timeout": "6h", + "aws_s3_bucket_name": "{{env `AWS_S3_BUCKET`}}" + } +} +