Skip to content

Instantly share code, notes, and snippets.

@sc250024
Last active April 22, 2018 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sc250024/15eb5bbb7419ccb31f5bb694f26398b8 to your computer and use it in GitHub Desktop.
Save sc250024/15eb5bbb7419ccb31f5bb694f26398b8 to your computer and use it in GitHub Desktop.
<powershell>
write-output "Running User Data Script"
write-host "(host) Running User Data Script"
Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force -ErrorAction Ignore
# Don't set this before Set-ExecutionPolicy as it throws an error
$ErrorActionPreference = "stop"
# Remove HTTP listener
Remove-Item -Path WSMan:\Localhost\listener\listener* -Recurse
$Cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName "packer"
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $Cert.Thumbprint -Force
# WinRM
write-output "Setting up WinRM"
write-host "(host) setting up WinRM"
cmd.exe /c winrm quickconfig -q
cmd.exe /c winrm set "winrm/config" '@{MaxTimeoutms="1800000"}'
cmd.exe /c winrm set "winrm/config/winrs" '@{MaxMemoryPerShellMB="1024"}'
cmd.exe /c winrm set "winrm/config/service" '@{AllowUnencrypted="true"}'
cmd.exe /c winrm set "winrm/config/client" '@{AllowUnencrypted="true"}'
cmd.exe /c winrm set "winrm/config/service/auth" '@{Basic="true"}'
cmd.exe /c winrm set "winrm/config/client/auth" '@{Basic="true"}'
cmd.exe /c winrm set "winrm/config/service/auth" '@{CredSSP="true"}'
cmd.exe /c winrm set "winrm/config/listener?Address=*+Transport=HTTPS" "@{Port=`"5986`";Hostname=`"packer`";CertificateThumbprint=`"$($Cert.Thumbprint)`"}"
cmd.exe /c netsh advfirewall firewall set rule group="remote administration" new enable=yes
cmd.exe /c netsh firewall add portopening TCP 5986 "Port 5986"
cmd.exe /c net stop winrm
cmd.exe /c sc config winrm start= auto
cmd.exe /c net start winrm
</powershell>
14:10 $ PACKER_LOG=1 packer build -force windows-server-2016-test.json
2018/04/22 14:24:28 [INFO] Packer version: 1.2.2
2018/04/22 14:24:28 Packer Target OS/Arch: darwin amd64
2018/04/22 14:24:28 Built with Go Version: go1.10
2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 Using internal plugin for virtualbox-iso
2018/04/22 14:24:28 Using internal plugin for vmware-vmx
2018/04/22 14:24:28 Using internal plugin for cloudstack
2018/04/22 14:24:28 Using internal plugin for triton
2018/04/22 14:24:28 Using internal plugin for lxc
2018/04/22 14:24:28 Using internal plugin for parallels-iso
2018/04/22 14:24:28 Using internal plugin for amazon-instance
2018/04/22 14:24:28 Using internal plugin for digitalocean
2018/04/22 14:24:28 Using internal plugin for scaleway
2018/04/22 14:24:28 Using internal plugin for amazon-ebssurrogate
2018/04/22 14:24:28 Using internal plugin for oneandone
2018/04/22 14:24:28 Using internal plugin for oracle-classic
2018/04/22 14:24:28 Using internal plugin for parallels-pvm
2018/04/22 14:24:28 Using internal plugin for qemu
2018/04/22 14:24:28 Using internal plugin for alicloud-ecs
2018/04/22 14:24:28 Using internal plugin for file
2018/04/22 14:24:28 Using internal plugin for googlecompute
2018/04/22 14:24:28 Using internal plugin for lxd
2018/04/22 14:24:28 Using internal plugin for amazon-ebs
2018/04/22 14:24:28 Using internal plugin for azure-arm
2018/04/22 14:24:28 Using internal plugin for ncloud
2018/04/22 14:24:28 Using internal plugin for virtualbox-ovf
2018/04/22 14:24:28 Using internal plugin for amazon-chroot
2018/04/22 14:24:28 Using internal plugin for docker
2018/04/22 14:24:28 Using internal plugin for openstack
2018/04/22 14:24:28 Using internal plugin for oracle-oci
2018/04/22 14:24:28 Using internal plugin for profitbricks
2018/04/22 14:24:28 Using internal plugin for hyperv-vmcx
2018/04/22 14:24:28 Using internal plugin for null
2018/04/22 14:24:28 Using internal plugin for vmware-iso
2018/04/22 14:24:28 Using internal plugin for amazon-ebsvolume
2018/04/22 14:24:28 Using internal plugin for hyperv-iso
2018/04/22 14:24:28 Using internal plugin for windows-shell
2018/04/22 14:24:28 Using internal plugin for ansible-local
2018/04/22 14:24:28 Using internal plugin for chef-solo
2018/04/22 14:24:28 Using internal plugin for puppet-server
2018/04/22 14:24:28 Using internal plugin for shell
2018/04/22 14:24:28 Using internal plugin for windows-restart
2018/04/22 14:24:28 Using internal plugin for chef-client
2018/04/22 14:24:28 Using internal plugin for file
2018/04/22 14:24:28 Using internal plugin for salt-masterless
2018/04/22 14:24:28 Using internal plugin for converge
2018/04/22 14:24:28 Using internal plugin for powershell
2018/04/22 14:24:28 Using internal plugin for puppet-masterless
2018/04/22 14:24:28 Using internal plugin for shell-local
2018/04/22 14:24:28 Using internal plugin for ansible
2018/04/22 14:24:28 Using internal plugin for checksum
2018/04/22 14:24:28 Using internal plugin for shell-local
2018/04/22 14:24:28 Using internal plugin for vagrant-cloud
2018/04/22 14:24:28 Using internal plugin for vsphere
2018/04/22 14:24:28 Using internal plugin for alicloud-import
2018/04/22 14:24:28 Using internal plugin for amazon-import
2018/04/22 14:24:28 Using internal plugin for compress
2018/04/22 14:24:28 Using internal plugin for docker-push
2018/04/22 14:24:28 Using internal plugin for docker-tag
2018/04/22 14:24:28 Using internal plugin for manifest
2018/04/22 14:24:28 Using internal plugin for docker-import
2018/04/22 14:24:28 Using internal plugin for vagrant
2018/04/22 14:24:28 Using internal plugin for vsphere-template
2018/04/22 14:24:28 Using internal plugin for artifice
2018/04/22 14:24:28 Using internal plugin for atlas
2018/04/22 14:24:28 Using internal plugin for docker-save
2018/04/22 14:24:28 Using internal plugin for googlecompute-export
2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 Attempting to open config file: /Users/myuser/.packerconfig
2018/04/22 14:24:28 [WARN] Config file doesn't exist: /Users/myuser/.packerconfig
2018/04/22 14:24:28 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[triton:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-triton oracle-classic:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oracle-classic virtualbox-ovf:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-ovf alicloud-ecs:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-alicloud-ecs file:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-file lxd:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxd azure-arm:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-azure-arm hyperv-vmcx:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-vmcx vmware-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-iso vmware-vmx:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-vmx ncloud:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-ncloud amazon-chroot:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-chroot hyperv-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-iso amazon-instance:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-instance oneandone:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oneandone virtualbox-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-iso lxc:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxc parallels-iso:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-iso docker:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-docker null:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-null digitalocean:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-digitalocean qemu:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu oracle-oci:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oracle-oci amazon-ebsvolume:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebsvolume scaleway:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-scaleway parallels-pvm:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-pvm googlecompute:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-googlecompute amazon-ebs:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebs cloudstack:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-cloudstack amazon-ebssurrogate:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebssurrogate openstack:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-openstack profitbricks:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-profitbricks] PostProcessors:map[docker-push:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-push atlas:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-atlas shell-local:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-shell-local amazon-import:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-amazon-import compress:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-compress manifest:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-manifest vagrant:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant googlecompute-export:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-googlecompute-export checksum:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-checksum vsphere:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere alicloud-import:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-alicloud-import docker-tag:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-tag docker-import:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-import vsphere-template:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere-template artifice:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-artifice docker-save:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-save vagrant-cloud:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant-cloud] Provisioners:map[windows-shell:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-shell chef-solo:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-solo chef-client:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-client salt-masterless:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-salt-masterless puppet-masterless:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-masterless shell-local:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell-local converge:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-converge puppet-server:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-server windows-restart:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-restart powershell:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-powershell ansible-local:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible-local shell:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell file:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file ansible:/usr/local/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible]}
2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 Setting cache directory: /Users/myuser/Documents/git-projects/mycompany/mycompany-packer/packer_cache
2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 Loading builder: amazon-ebs
2018/04/22 14:24:28 Plugin could not be found. Checking same directory as executable.
2018/04/22 14:24:28 Current exe path: /usr/local/bin/packer
2018/04/22 14:24:28 Creating plugin client for path: /usr/local/bin/packer
2018/04/22 14:24:28 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-builder-amazon-ebs"}
2018/04/22 14:24:28 Waiting for RPC address for: /usr/local/bin/packer
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 [INFO] Packer version: 1.2.2
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Packer Target OS/Arch: darwin amd64
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Built with Go Version: go1.10
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Attempting to open config file: /Users/myuser/.packerconfig
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 [WARN] Config file doesn't exist: /Users/myuser/.packerconfig
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]}
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Setting cache directory: /Users/myuser/Documents/git-projects/mycompany/mycompany-packer/packer_cache
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 args: []string{"packer-builder-amazon-ebs"}
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin minimum port: 10000
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin maximum port: 25000
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin address: unix /var/folders/kj/0vbbpst91p335xd5d1jq7skh0000gn/T/packer-plugin391261006
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Waiting for connection...
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Serving a plugin connection...
2018/04/22 14:24:28 Loading provisioner: powershell
2018/04/22 14:24:28 Plugin could not be found. Checking same directory as executable.
2018/04/22 14:24:28 Current exe path: /usr/local/bin/packer
2018/04/22 14:24:28 Creating plugin client for path: /usr/local/bin/packer
2018/04/22 14:24:28 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-powershell"}
2018/04/22 14:24:28 Waiting for RPC address for: /usr/local/bin/packer
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 [INFO] Packer version: 1.2.2
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Packer Target OS/Arch: darwin amd64
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Built with Go Version: go1.10
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Attempting to open config file: /Users/myuser/.packerconfig
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 [WARN] Config file doesn't exist: /Users/myuser/.packerconfig
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]}
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Setting cache directory: /Users/myuser/Documents/git-projects/mycompany/mycompany-packer/packer_cache
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 args: []string{"packer-provisioner-powershell"}
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin minimum port: 10000
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin maximum port: 25000
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin address: unix /var/folders/kj/0vbbpst91p335xd5d1jq7skh0000gn/T/packer-plugin933143325
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Waiting for connection...
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Serving a plugin connection...
2018/04/22 14:24:28 Loading provisioner: powershell
2018/04/22 14:24:28 Plugin could not be found. Checking same directory as executable.
2018/04/22 14:24:28 Current exe path: /usr/local/bin/packer
2018/04/22 14:24:28 Creating plugin client for path: /usr/local/bin/packer
2018/04/22 14:24:28 Starting plugin: /usr/local/bin/packer []string{"/usr/local/bin/packer", "plugin", "packer-provisioner-powershell"}
2018/04/22 14:24:28 Waiting for RPC address for: /usr/local/bin/packer
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 [INFO] Packer version: 1.2.2
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Packer Target OS/Arch: darwin amd64
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Built with Go Version: go1.10
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Attempting to open config file: /Users/myuser/.packerconfig
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 [WARN] Config file doesn't exist: /Users/myuser/.packerconfig
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]}
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Setting cache directory: /Users/myuser/Documents/git-projects/mycompany/mycompany-packer/packer_cache
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Detected home directory from env var: /Users/myuser
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 args: []string{"packer-provisioner-powershell"}
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin minimum port: 10000
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin maximum port: 25000
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Plugin address: unix /var/folders/kj/0vbbpst91p335xd5d1jq7skh0000gn/T/packer-plugin477553535
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Waiting for connection...
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Serving a plugin connection...
2018/04/22 14:24:28 ui: amazon-ebs output will be in this color.
2018/04/22 14:24:28 ui:
2018/04/22 14:24:28 Build debug mode: false
2018/04/22 14:24:28 Force build: true
2018/04/22 14:24:28 On error:
2018/04/22 14:24:28 Preparing build: amazon-ebs
amazon-ebs output will be in this color.
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Config: {PackerConfig:{PackerBuildName:amazon-ebs PackerBuilderType:amazon-ebs PackerDebug:false PackerForce:true PackerOnError: PackerUserVars:map[vpc_id: name:winsrv2016-amd64-base region:us-west-2]} AccessConfig:{AccessKey: CustomEndpointEc2: MFACode: ProfileName: RawRegion:us-west-2 SecretKey: SkipValidation:false SkipMetadataApiCheck:false Token: session:<nil>} AMIConfig:{AMIName:winsrv2016-amd64-base AMIDescription: AMIVirtType: AMIUsers:[] AMIGroups:[] AMIProductCodes:[] AMIRegions:[] A==> amazon-ebs: Force Deregister flag found, skipping prevalidating AMI Name
MISkipRegionValidation:false AMITags:map[Name:{{user `name`}}-{{ isotime | clean_ami_name }} Version:{{ isotime | clean_ami_name }}] AMIENASupport:false AMISriovNetSupport:false AMIForceDeregister:true AMIForceDeleteSnapshot:false AMIEncryptBootVolume:false AMIKmsKeyId: AMIRegionKMSKeyIDs:map[] SnapshotTags:map[] SnapshotUsers:[] SnapshotGroups:[]} BlockDevices:{AMIBlockDevices:{AMIMappings:[{DeleteOnTermination:true DeviceName:/dev/sda1 Encrypted:false IOPS:0 NoDevice:false SnapshotId: VirtualName: VolumeType:gp2 VolumeSize:50 KmsKeyId:}]} LaunchBlockDevices:{LaunchMappings:[{DeleteOnTermination:true DeviceName:/dev/sda1 Encrypted:false IOPS:0 NoDevice:false SnapshotId: VirtualName: VolumeType: VolumeSize:0 KmsKeyId:}]}} RunConfig:{AssociatePublicIpAddress:false AvailabilityZone: EbsOptimized:false IamInstanceProfile: InstanceType:t2.medium RunTags:map[Name:Packer Builder (Windows 2016)] SourceAmi: SourceAmiFilter:{Filters:map[0xc4204ab460:0xc4204ab480] Owners:[0xc4204ab500] MostRecent:true} SpotPrice:auto SpotPriceAutoProduct:Windows (Amazon VPC) DisableStopInstance:false SecurityGroupId: SecurityGroupIds:[] TemporarySGSourceCidr:0.0.0.0/0 SubnetId: TemporaryKeyPairName:packer_5adc7efc-1d7d-b020-6edc-d2402d257027 UserData: UserDataFile:/Users/myuser/Documents/git-projects/mycompany/mycompany-packer/bootstrap/aws/userdata/bootstrap-aws.txt WindowsPasswordTimeout:30m0s VpcId: InstanceInitiatedShutdownBehavior:stop Comm:{Type:winrm SSHHost: SSHPort:0 SSHUsername: SSHPassword: SSHPrivateKey: SSHPty:false SSHTimeout:0s SSHAgentAuth:false SSHDisableAgentForwarding:false SSHHandshakeAttempts:0 SSHBastionHost: SSHBastionPort:0 SSHBastionAgentAuth:false SSHBastionUsername: SSHBastionPassword: SSHBastionPrivateKey: SSHFileTransferMethod: SSHProxyHost: SSHProxyPort:0 SSHProxyUsername: SSHProxyPassword: SSHKeepAliveInterval:0s SSHReadWriteTimeout:0s WinRMUser:Administrator WinRMPassword: WinRMHost: WinRMPort:5986 WinRMTimeout:30m0s WinRMUseSSL:true WinRMInsecure:true WinRMUseNTLM:false WinRMTransportDecorator:<nil>} SSHKeyPairName: SSHInterface:} VolumeRunTags:map[] ctx:{Data:<nil> Funcs:map[clean_ami_name:0x1842050] UserVariables:map[region:us-west-2 vpc_id: name:winsrv2016-amd64-base] EnableEnv:false BuildName:amazon-ebs BuildType:amazon-ebs TemplatePath:/Users/myuser/Documents/git-projects/mycompany/mycompany-packer/windows-server-2016-test.json}}
2018/04/22 14:24:28 Waiting on builds to complete...
2018/04/22 14:24:28 Starting build run: amazon-ebs
2018/04/22 14:24:28 Running builder: amazon-ebs
2018/04/22 14:24:28 [INFO] (telemetry) Starting builder amazon-ebs
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Found region us-west-2
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 [INFO] AWS Auth provider used: "SharedConfigCredentials: /Users/myuser/.aws/credentials"
2018/04/22 14:24:28 ui: ==> amazon-ebs: Force Deregister flag found, skipping prevalidating AMI Name
2018/04/22 14:24:28 packer: 2018/04/22 14:24:28 Using AMI Filters {
2018/04/22 14:24:28 packer: Filters: [{
2018/04/22 14:24:28 packer: Name: "name",
2018/04/22 14:24:28 packer: Values: ["Windows_Server-2016-English-Full-Base-*"]
2018/04/22 14:24:28 packer: }],
2018/04/22 14:24:28 packer: Owners: ["801119661308"]
2018/04/22 14:24:28 packer: }
2018/04/22 14:24:37 ui: amazon-ebs: Found Image ID: ami-f3dcbc8b
amazon-ebs: Found Image ID: ami-f3dcbc8b
2018/04/22 14:24:37 ui: ==> amazon-ebs: Creating temporary keypair: packer_5adc7efc-1d7d-b020-6edc-d2402d257027
==> amazon-ebs: Creating temporary keypair: packer_5adc7efc-1d7d-b020-6edc-d2402d257027
2018/04/22 14:24:37 ui: ==> amazon-ebs: Creating temporary security group for this instance: packer_5adc7f05-078e-7a16-7677-fc4bad6c9925
==> amazon-ebs: Creating temporary security group for this instance: packer_5adc7f05-078e-7a16-7677-fc4bad6c9925
2018/04/22 14:24:38 ui: ==> amazon-ebs: Authorizing access to port 5986 from 0.0.0.0/0 in the temporary security group...
==> amazon-ebs: Authorizing access to port 5986 from 0.0.0.0/0 in the temporary security group...
2018/04/22 14:24:38 packer: 2018/04/22 14:24:38 [DEBUG] Waiting for temporary security group: sg-07fe1926dc9954ca1
2018/04/22 14:24:38 packer: 2018/04/22 14:24:38 [DEBUG] Found security group sg-07fe1926dc9954ca1
2018/04/22 14:24:38 packer: 2018/04/22 14:24:38 [DEBUG] base64 encoding user data...
2018/04/22 14:24:38 ui: ==> amazon-ebs: Launching a source AWS instance...
==> amazon-ebs: Launching a source AWS instance...
2018/04/22 14:24:38 ui: amazon-ebs: Finding spot price for Windows (Amazon VPC) t2.medium...
amazon-ebs: Finding spot price for Windows (Amazon VPC) t2.medium...
2018/04/22 14:24:39 packer: 2018/04/22 14:24:39 [INFO] Candidate spot price: 0.031900
2018/04/22 14:24:39 packer: 2018/04/22 14:24:39 [INFO] Candidate spot price: 0.031900
2018/04/22 14:24:39 packer: 2018/04/22 14:24:39 [INFO] Candidate spot price: 0.031900
2018/04/22 14:24:39 ui: ==> amazon-ebs: Adding tags to source instance
==> amazon-ebs: Adding tags to source instance
2018/04/22 14:24:39 ui: amazon-ebs: Adding tag: "Name": "Packer Builder (Windows 2016)"
amazon-ebs: Adding tag: "Name": "Packer Builder (Windows 2016)"
2018/04/22 14:24:39 ui: amazon-ebs: Requesting spot instance 't2.medium' for: 0.036899999999999995
amazon-ebs: Requesting spot instance 't2.medium' for: 0.036899999999999995
2018/04/22 14:24:39 ui: amazon-ebs: Waiting for spot request (sir-w4ei8qxm) to become active...
amazon-ebs: Waiting for spot request (sir-w4ei8qxm) to become active...
2018/04/22 14:24:39 packer: 2018/04/22 14:24:39 Waiting for state to become: active
2018/04/22 14:24:39 packer: 2018/04/22 14:24:39 Using 2s as polling delay (change with AWS_POLL_DELAY_SECONDS)
2018/04/22 14:24:39 packer: 2018/04/22 14:24:39 Allowing 300s to complete (change with AWS_TIMEOUT_SECONDS)
2018/04/22 14:24:42 ui: amazon-ebs: Instance ID: i-06159742fb5780b74
amazon-ebs: Instance ID: i-06159742fb5780b74
2018/04/22 14:24:42 ui: ==> amazon-ebs: Waiting for instance (i-06159742fb5780b74) to become ready...
==> amazon-ebs: Waiting for instance (i-06159742fb5780b74) to become ready...
2018/04/22 14:24:59 ui: ==> amazon-ebs: Waiting for auto-generated password for instance...
==> amazon-ebs: Waiting for auto-generated password for instance...
2018/04/22 14:24:59 ui: amazon-ebs: It is normal for this process to take up to 15 minutes,
amazon-ebs: but it usually takes around 5. Please wait.
amazon-ebs: It is normal for this process to take up to 15 minutes,
amazon-ebs: but it usually takes around 5. Please wait.
2018/04/22 14:25:05 packer: 2018/04/22 14:25:05 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:10 packer: 2018/04/22 14:25:10 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:15 packer: 2018/04/22 14:25:15 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:20 packer: 2018/04/22 14:25:20 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:25 packer: 2018/04/22 14:25:25 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:31 packer: 2018/04/22 14:25:31 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:36 packer: 2018/04/22 14:25:36 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:41 packer: 2018/04/22 14:25:41 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:47 packer: 2018/04/22 14:25:47 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:52 packer: 2018/04/22 14:25:52 [DEBUG] Password is blank, will retry...
2018/04/22 14:25:57 packer: 2018/04/22 14:25:57 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:02 packer: 2018/04/22 14:26:02 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:07 packer: 2018/04/22 14:26:07 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:13 packer: 2018/04/22 14:26:13 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:18 packer: 2018/04/22 14:26:18 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:23 packer: 2018/04/22 14:26:23 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:28 packer: 2018/04/22 14:26:28 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:33 packer: 2018/04/22 14:26:33 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:38 packer: 2018/04/22 14:26:38 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:44 packer: 2018/04/22 14:26:44 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:49 packer: 2018/04/22 14:26:49 [DEBUG] Password is blank, will retry...
2018/04/22 14:26:55 packer: 2018/04/22 14:26:55 [DEBUG] Password is blank, will retry...
2018/04/22 14:27:00 packer: 2018/04/22 14:27:00 [DEBUG] Password is blank, will retry...
2018/04/22 14:27:05 packer: 2018/04/22 14:27:05 [DEBUG] Password is blank, will retry...
2018/04/22 14:27:10 packer: 2018/04/22 14:27:10 [DEBUG] Password is blank, will retry...
2018/04/22 14:27:15 packer: 2018/04/22 14:27:15 [DEBUG] Password is blank, will retry...
2018/04/22 14:27:21 packer: 2018/04/22 14:27:21 [DEBUG] Password is blank, will retry...
amazon-ebs:
2018/04/22 14:27:26 ui: amazon-ebs:
amazon-ebs: Password retrieved!
amazon-ebs: Password retrieved!
2018/04/22 14:27:26 packer: 2018/04/22 14:27:26 Waiting for WinRM, up to timeout: 30m0s
2018/04/22 14:27:26 ui: ==> amazon-ebs: Waiting for WinRM to become available...
==> amazon-ebs: Waiting for WinRM to become available...
2018/04/22 14:27:31 packer: 2018/04/22 14:27:31 [INFO] Attempting WinRM connection...
2018/04/22 14:27:31 packer: 2018/04/22 14:27:31 [DEBUG] connecting to remote shell using WinRM
2018/04/22 14:28:01 packer: 2018/04/22 14:28:01 [ERROR] connection error: unknown error Post https://<temp-aws-external-ip>:5986/wsman: dial tcp <temp-aws-external-ip>:5986: i/o timeout
2018/04/22 14:28:01 packer: 2018/04/22 14:28:01 [ERROR] WinRM connection err: unknown error Post https://<temp-aws-external-ip>:5986/wsman: dial tcp <temp-aws-external-ip>:5986: i/o timeout
2018/04/22 14:28:06 packer: 2018/04/22 14:28:06 [INFO] Attempting WinRM connection...
2018/04/22 14:28:06 packer: 2018/04/22 14:28:06 [DEBUG] connecting to remote shell using WinRM
2018/04/22 14:28:12 packer: 2018/04/22 14:28:12 Checking that WinRM is connected with: 'powershell.exe -EncodedCommand aQBmACAAKABUAGUAcwB0AC0AUABhAHQAaAAgAHYAYQByAGkAYQBiAGwAZQA6AGcAbABvAGIAYQBsADoAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAKQB7ACQAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAPQAnAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAJwB9ADsAIABlAGMAaABvACAAIgBXAGkAbgBSAE0AIABjAG8AbgBuAGUAYwB0AGUAZAAuACIA'
2018/04/22 14:28:13 packer: 2018/04/22 14:28:13 [INFO] starting remote command: powershell.exe -EncodedCommand aQBmACAAKABUAGUAcwB0AC0AUABhAHQAaAAgAHYAYQByAGkAYQBiAGwAZQA6AGcAbABvAGIAYQBsADoAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAKQB7ACQAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAPQAnAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAJwB9ADsAIABlAGMAaABvACAAIgBXAGkAbgBSAE0AIABjAG8AbgBuAGUAYwB0AGUAZAAuACIA
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 [INFO] command 'powershell.exe -EncodedCommand aQBmACAAKABUAGUAcwB0AC0AUABhAHQAaAAgAHYAYQByAGkAYQBiAGwAZQA6AGcAbABvAGIAYQBsADoAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAKQB7ACQAUAByAG8AZwByAGUAcwBzAFAAcgBlAGYAZQByAGUAbgBjAGUAPQAnAFMAaQBsAGUAbgB0AGwAeQBDAG8AbgB0AGkAbgB1AGUAJwB9ADsAIABlAGMAaABvACAAIgBXAGkAbgBSAE0AIABjAG8AbgBuAGUAYwB0AGUAZAAuACIA' exited with code: 0
2018/04/22 14:28:14 ui: amazon-ebs: WinRM connected.
amazon-ebs: WinRM connected.
2018/04/22 14:28:14 ui: amazon-ebs: #< CLIXML
amazon-ebs: #< CLIXML
2018/04/22 14:28:14 ui: amazon-ebs: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Connected to machine
2018/04/22 14:28:14 ui: ==> amazon-ebs: Connected to WinRM!
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Running the provision hook
amazon-ebs: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
==> amazon-ebs: Connected to WinRM!
2018/04/22 14:28:14 [INFO] (telemetry) Starting provisioner powershell
2018/04/22 14:28:14 ui: ==> amazon-ebs: Provisioning with Powershell...
==> amazon-ebs: Provisioning with Powershell...
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Found command: C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Found command: C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\SysprepInstance.ps1 -NoShutdown
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Found command: Write-Host 'Some test output #1...'
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Found command: Write-Host 'Some test output #2...'
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Found command: Write-Host 'Some test output #3...'
2018/04/22 14:28:14 ui: ==> amazon-ebs: Provisioning with powershell script: /var/folders/kj/0vbbpst91p335xd5d1jq7skh0000gn/T/packer-powershell-provisioner218123736
==> amazon-ebs: Provisioning with powershell script: /var/folders/kj/0vbbpst91p335xd5d1jq7skh0000gn/T/packer-powershell-provisioner218123736
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Opening /var/folders/kj/0vbbpst91p335xd5d1jq7skh0000gn/T/packer-powershell-provisioner218123736 for reading
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 Uploading env vars to ${env:SYSTEMROOT}/Temp/packer-env-vars-5adc7fde-e474-d60f-72f9-209b5ecc23ce.ps1
2018/04/22 14:28:14 packer: 2018/04/22 14:28:14 [INFO] 76 bytes written for 'uploadData'
2018/04/22 14:28:14 [INFO] 76 bytes written for 'uploadData'
2018/04/22 14:28:16 packer: 2018/04/22 14:28:16 Uploading file to '${env:SYSTEMROOT}/Temp/packer-env-vars-5adc7fde-e474-d60f-72f9-209b5ecc23ce.ps1'
2018/04/22 14:28:19 packer: #< CLIXML
2018/04/22 14:28:20 packer: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>#< CLIXML
2018/04/22 14:28:21 packer: 2018/04/22 14:28:21 Building elevated command wrapper for: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. ${env:SYSTEMROOT}/Temp/packer-env-vars-5adc7fde-e474-d60f-72f9-209b5ecc23ce.ps1; &'c:/Windows/Temp/script-5adc7efc-571d-b756-04a9-6ba3c6af5433.ps1'; exit $LastExitCode }"
2018/04/22 14:28:21 packer: 2018/04/22 14:28:21 Command [powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. ${env:SYSTEMROOT}/Temp/packer-env-vars-5adc7fde-e474-d60f-72f9-209b5ecc23ce.ps1; &'c:/Windows/Temp/script-5adc7efc-571d-b756-04a9-6ba3c6af5433.ps1'; exit $LastExitCode }" > %SYSTEMROOT%/Temp/packer-5adc7fe5-d862-2bf3-7021-74a0d2480f02.out 2>&1] converted to [powershell -executionpolicy bypass &#34;&amp; { if (Test-Path variable:global:ProgressPreference){$ProgressPreference=&#39;SilentlyContinue&#39;};. ${env:SYSTEMROOT}/Temp/packer-env-vars-5adc7fde-e474-d60f-72f9-209b5ecc23ce.ps1; &amp;&#39;c:/Windows/Temp/script-5adc7efc-571d-b756-04a9-6ba3c6af5433.ps1&#39;; exit $LastExitCode }&#34; &gt; %SYSTEMROOT%/Temp/packer-5adc7fe5-d862-2bf3-7021-74a0d2480f02.out 2&gt;&amp;1] for use in XML string
2018/04/22 14:28:21 packer: 2018/04/22 14:28:21 Uploading elevated shell wrapper for command [powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. ${env:SYSTEMROOT}/Temp/packer-env-vars-5adc7fde-e474-d60f-72f9-209b5ecc23ce.ps1; &'c:/Windows/Temp/script-5adc7efc-571d-b756-04a9-6ba3c6af5433.ps1'; exit $LastExitCode }" > %SYSTEMROOT%/Temp/packer-5adc7fe5-d862-2bf3-7021-74a0d2480f02.out 2>&1] to [${env:TEMP}/packer-elevated-shell-5adc7fe5-52d1-8dbd-cba2-4ae73f08077d.ps1]
2018/04/22 14:28:21 packer: 2018/04/22 14:28:21 [INFO] 2796 bytes written for 'uploadData'
2018/04/22 14:28:21 [INFO] 2796 bytes written for 'uploadData'
2018/04/22 14:28:22 packer: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>2018/04/22 14:28:22 Uploading file to '${env:TEMP}/packer-elevated-shell-5adc7fe5-52d1-8dbd-cba2-4ae73f08077d.ps1'
2018/04/22 14:28:25 packer: #< CLIXML
2018/04/22 14:28:27 packer: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>#< CLIXML
2018/04/22 14:28:27 packer: 2018/04/22 14:28:27 [INFO] 271 bytes written for 'uploadData'
2018/04/22 14:28:27 [INFO] 271 bytes written for 'uploadData'
2018/04/22 14:28:29 packer: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>2018/04/22 14:28:29 Uploading file to 'c:/Windows/Temp/script-5adc7efc-571d-b756-04a9-6ba3c6af5433.ps1'
2018/04/22 14:28:31 packer: #< CLIXML
2018/04/22 14:28:32 packer: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>#< CLIXML
2018/04/22 14:28:33 packer: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>2018/04/22 14:28:33 [INFO] starting remote command: powershell -executionpolicy bypass -file "%TEMP%/packer-elevated-shell-5adc7fe5-52d1-8dbd-cba2-4ae73f08077d.ps1"
amazon-ebs:
2018/04/22 14:28:37 ui: amazon-ebs:
2018/04/22 14:28:37 ui: amazon-ebs: TaskPath TaskName State
amazon-ebs: TaskPath TaskName State
2018/04/22 14:28:37 ui: amazon-ebs: -------- -------- -----
amazon-ebs: -------- -------- -----
2018/04/22 14:28:37 ui: amazon-ebs: \ Amazon Ec2 Launch - Instance I... Ready
amazon-ebs: \ Amazon Ec2 Launch - Instance I... Ready
amazon-ebs: Some test output #1...
2018/04/22 14:30:52 ui: amazon-ebs: Some test output #1...
2018/04/22 14:30:52 ui: amazon-ebs: Some test output #2...
amazon-ebs: Some test output #2...
amazon-ebs: Some test output #3...
2018/04/22 14:30:52 ui: amazon-ebs: Some test output #3...
2018/04/22 14:30:52 packer: 2018/04/22 14:30:52 [INFO] command 'powershell -executionpolicy bypass -file "%TEMP%/packer-elevated-shell-5adc7fe5-52d1-8dbd-cba2-4ae73f08077d.ps1"' exited with code: 0
2018/04/22 14:30:52 packer: 2018/04/22 14:30:52 [INFO] RPC endpoint: Communicator ended with: 0
2018/04/22 14:30:52 [INFO] 353 bytes written for 'stdout'
2018/04/22 14:30:52 [INFO] 0 bytes written for 'stderr'
2018/04/22 14:30:52 [INFO] RPC client: Communicator ended with: 0
2018/04/22 14:30:52 [INFO] RPC endpoint: Communicator ended with: 0
2018/04/22 14:30:52 packer: 2018/04/22 14:30:52 [INFO] 353 bytes written for 'stdout'
2018/04/22 14:30:52 packer: 2018/04/22 14:30:52 [INFO] 0 bytes written for 'stderr'
2018/04/22 14:30:52 packer: 2018/04/22 14:30:52 [INFO] RPC client: Communicator ended with: 0
2018/04/22 14:30:52 [INFO] (telemetry) ending powershell
2018/04/22 14:30:52 [INFO] (telemetry) Starting provisioner powershell
2018/04/22 14:30:52 ui: ==> amazon-ebs: Provisioning with Powershell...
==> amazon-ebs: Provisioning with Powershell...
2018/04/22 14:30:52 ui: ==> amazon-ebs: Provisioning with powershell script: /Users/myuser/Documents/git-projects/mycompany/mycompany-packer/provisioners/powershell/test.ps1
2018/04/22 14:30:52 packer: 2018/04/22 14:30:52 Opening /Users/myuser/Documents/git-projects/mycompany/mycompany-packer/provisioners/powershell/test.ps1 for reading
==> amazon-ebs: Provisioning with powershell script: /Users/myuser/Documents/git-projects/mycompany/mycompany-packer/provisioners/powershell/test.ps1
2018/04/22 14:30:52 packer: 2018/04/22 14:30:52 Uploading env vars to ${env:SYSTEMROOT}/Temp/packer-env-vars-5adc807c-b3f9-4afe-d77d-5c55eb5c066c.ps1
2018/04/22 14:30:52 packer: 2018/04/22 14:30:52 [INFO] 76 bytes written for 'uploadData'
2018/04/22 14:30:52 [INFO] 76 bytes written for 'uploadData'
2018/04/22 14:30:53 [INFO] (telemetry) ending powershell
2018/04/22 14:30:53 ui: ==> amazon-ebs: Cancelling the spot request...
==> amazon-ebs: Cancelling the spot request...
2018/04/22 14:30:57 packer: 2018/04/22 14:30:57 Waiting for state to become: cancelled
2018/04/22 14:30:57 packer: 2018/04/22 14:30:57 Using 2s as polling delay (change with AWS_POLL_DELAY_SECONDS)
2018/04/22 14:30:57 packer: 2018/04/22 14:30:57 Allowing 300s to complete (change with AWS_TIMEOUT_SECONDS)
2018/04/22 14:30:57 ui: ==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Terminating the source AWS instance...
2018/04/22 14:30:57 packer: 2018/04/22 14:30:57 Waiting for state to become: terminated
2018/04/22 14:30:57 packer: 2018/04/22 14:30:57 Using 2s as polling delay (change with AWS_POLL_DELAY_SECONDS)
2018/04/22 14:30:57 packer: 2018/04/22 14:30:57 Allowing 300s to complete (change with AWS_TIMEOUT_SECONDS)
2018/04/22 14:31:22 ui: ==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: Cleaning up any extra volumes...
2018/04/22 14:31:22 ui: ==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: No volumes to clean up, skipping
2018/04/22 14:31:22 ui: ==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary security group...
2018/04/22 14:31:22 ui: ==> amazon-ebs: Deleting temporary keypair...
==> amazon-ebs: Deleting temporary keypair...
2018/04/22 14:31:23 [INFO] (telemetry) ending amazon-ebs
2018/04/22 14:31:23 ui error: Build 'amazon-ebs' errored: Error processing command: Error uploading ps script containing env vars: Couldn't determine whether destination was a folder or file: unknown error Post https://<temp-aws-external-ip>:5986/wsman: read tcp 100.70.14.130:52062-><temp-aws-external-ip>:5986: read: connection reset by peer
2018/04/22 14:31:23 Builds completed. Waiting on interrupt barrier...
2018/04/22 14:31:23 machine readable: error-count []string{"1"}
2018/04/22 14:31:23 ui error:
==> Some builds didn't complete successfully and had errors:
2018/04/22 14:31:23 machine readable: amazon-ebs,error []string{"Error processing command: Error uploading ps script containing env vars: Couldn't determine whether destination was a folder or file: unknown error Post https://<temp-aws-external-ip>:5986/wsman: read tcp 100.70.14.130:52062-><temp-aws-external-ip>:5986: read: connection reset by peer"}
2018/04/22 14:31:23 ui error: --> amazon-ebs: Error processing command: Error uploading ps script containing env vars: Couldn't determine whether destination was a folder or file: unknown error Post https://<temp-aws-external-ip>:5986/wsman: read tcp 100.70.14.130:52062-><temp-aws-external-ip>:5986: read: connection reset by peer
2018/04/22 14:31:23 ui:
==> Builds finished but no artifacts were created.
2018/04/22 14:31:23 [INFO] (telemetry) Finalizing.
Build 'amazon-ebs' errored: Error processing command: Error uploading ps script containing env vars: Couldn't determine whether destination was a folder or file: unknown error Post https://<temp-aws-external-ip>:5986/wsman: read tcp 100.70.14.130:52062-><temp-aws-external-ip>:5986: read: connection reset by peer
==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Error processing command: Error uploading ps script containing env vars: Couldn't determine whether destination was a folder or file: unknown error Post https://<temp-aws-external-ip>:5986/wsman: read tcp 100.70.14.130:52062-><temp-aws-external-ip>:5986: read: connection reset by peer
==> Builds finished but no artifacts were created.
2018/04/22 14:31:24 waiting for all plugin processes to complete...
2018/04/22 14:31:24 /usr/local/bin/packer: plugin process exited
2018/04/22 14:31:24 /usr/local/bin/packer: plugin process exited
2018/04/22 14:31:24 /usr/local/bin/packer: plugin process exited
{
"variables": {
"region": "{{ env `AWS_REGION` }}",
"vpc_id": "{{ env `AWS_VPC_ID` }}",
"name": "winsrv2016-amd64-base"
},
"builders": [{
"ami_name": "{{ user `name` }}",
"communicator": "winrm",
"instance_type": "t2.medium",
"region": "{{ user `region` }}",
"spot_price_auto_product": "Windows (Amazon VPC)",
"spot_price": "auto",
"type": "amazon-ebs",
"user_data_file": "{{ template_dir }}/bootstrap/aws/userdata/bootstrap-aws.txt",
"vpc_id": "{{ user `vpc_id` }}",
"windows_password_timeout": "30m",
"winrm_insecure": true,
"winrm_timeout": "30m",
"winrm_use_ssl": true,
"winrm_username": "Administrator",
"ami_block_device_mappings": [{
"delete_on_termination": true,
"device_name": "/dev/sda1",
"volume_size": 50,
"volume_type": "gp2"
}],
"launch_block_device_mappings": [{
"delete_on_termination": true,
"device_name": "/dev/sda1"
}],
"run_tags": {
"Name": "Packer Builder (Windows 2016)"
},
"source_ami_filter": {
"filters": {
"name": "Windows_Server-2016-English-Full-Base-*"
},
"owners": ["801119661308"],
"most_recent": true
},
"tags": {
"Name": "{{user `name`}}-{{ isotime | clean_ami_name }}",
"Version": "{{ isotime | clean_ami_name }}"
}
}],
"provisioners": [
{
"type": "powershell",
"elevated_user": "Administrator",
"elevated_password": "{{ .WinRMPassword }}",
"inline": [
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule",
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown",
"Write-Host 'Some test output #1...'",
"Write-Host 'Some test output #2...'",
"Write-Host 'Some test output #3...'"
]
},
{
"type": "powershell",
"elevated_user": "Administrator",
"elevated_password": "{{ .WinRMPassword }}",
"scripts": [
"{{ template_dir }}/provisioners/powershell/test.ps1"
]
}
]
}
Write-Host "Some test output #4..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment