windows_2016_ami.json 3.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{
  "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",
        "./scripts/unattend.xml",
        "./scripts/sysprep.bat"
      ],
      "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": "a:/sysprep.bat",
lmayorga's avatar
lmayorga committed
24
      "format": "ova",
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
      "type": "virtualbox-iso",
      "vboxmanage": [
        [
          "modifyvm",
          "{{.Name}}",
          "--memory",
          "2048"
        ],
        [
          "modifyvm",
          "{{.Name}}",
          "--cpus",
          "2"
        ]
      ],
      "vm_name": "WindowsServer2016",
      "winrm_password": "vagrant",
      "winrm_timeout": "{{user `winrm_timeout`}}",
      "winrm_username": "vagrant"
    }
  ],
  "post-processors": [
    {
      "keep_input_artifact": false,
      "output": "windows_2016_{{.Provider}}.box",
      "type": "vagrant",
      "vagrantfile_template": "vagrantfile-windows_2016.template"
    },
    {
      "type": "amazon-import",
      "only": ["virtualbox-iso"],
      "access_key": "",
      "secret_key": "",
      "region": "",
59
      "ami_name": "packer_windows_2016",
60 61 62 63 64
      "s3_bucket_name": "{{user `aws_s3_bucket_name`}}",
      "keep_input_artifact": false,
      "license_type": "BYOL",
      "tags": 
      {
65
      "Description": "packer-windows 2016 amazon-import {{timestamp}}"
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
      }
    }
  ],
  "provisioners": [
    {
      "execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
      "scripts": [
        "./scripts/enable-rdp.bat"
      ],
      "type": "windows-shell"
    },
    {
      "scripts": [
        "./scripts/debloat-windows.ps1"
      ],
      "type": "powershell"
    },
    {
      "restart_timeout": "{{user `restart_timeout`}}",
      "type": "windows-restart"
    },
    {
      "execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"",
      "scripts": [
        "./scripts/pin-powershell.bat",
        "./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/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",
    "restart_timeout": "5m",
    "winrm_timeout": "4h",
    "aws_s3_bucket_name": "{{env `AWS_S3_BUCKET`}}"
  }
}