Alright - well my initial problem is still an issue here: That I can't retrieve my Windows Password in AWS after creating a Packer AMI.
Is my only solution to set the Administrative password to something static from the get-go? <https://lh3.googleusercontent.com/-UaC5Fu1zIyY/WbmWT60OUCI/AAAAAAABwOU/o-K-lW631-Eg9doFUQax13_KoGLRIbB-gCLcBGAs/s1600/Screen%2BShot%2B2017-09-13%2Bat%2B4.33.25%2BPM.png> On Monday, September 11, 2017 at 4:59:23 PM UTC-4, TJ Biddle wrote: > > { > "variables": { > "aws_region": "us-west-2", > "vpc_id": "vpc-xxx", > "subnet_id": "subnet-xxx" > }, > > "builders": [{ > "type": "amazon-ebs", > "ami_name": "windows-jenkins-agent-with-docker {{isotime > | clean_ami_name}}", > "region": "{{user `aws_region`}}", > "instance_type": "t2.medium", > > "vpc_id": "{{user `vpc_id`}}", > "subnet_id": "{{user `subnet_id`}}", > "ssh_keypair_name": "key_pair_name_here", > "ssh_private_key_file": "/full/path/to/file.pem", > > "communicator": "winrm", > "winrm_username": "Administrator", > "winrm_use_ssl": true, > > "source_ami_filter": { > "owners": ["801119661308"], > "most_recent": true, > > "filters": { > "virtualization-type": "hvm", > "name": "*Windows_Server-2016-English-Full-Base*", > "root-device-type": "ebs" > } > }, > > "run_tags": { > "Name": "Packer-Temporary-Intance" > }, > > "run_volume_tags": { > "Name": "Packer-Temporary-Volume" > }, > > "tags": { > "OS_Version": "Windows", > "Release": "2016 Base", > "Source_AMI": "{{.SourceAMI}}", > "Build_Region": "{{.BuildRegion}}" > } > }], > > "provisioners": [ > { > "type": "file", > "source": "files/chocolatey-install.ps1", > "destination": "C:\\chocolatey-install.ps1" > }, > { > "type": "file", > "source": "files/init.ps1", > "destination": "C:\\init.ps1" > }, > { > "type": "file", > "source": "files/WinSW.NET4.xml", > "destination": "C:\\WinSW.NET4.xml" > }, > { > "type": "windows-restart" > } > ] > } > > > user-data: > <powershell> > > # This setup to get running via Powerhsell is taken from > https://github.com/PeteGoo/packer-win-aws > > 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 > > Set-Item WSMan:\localhost\MaxTimeoutms 1800000 > Set-Item WSMan:\localhost\Service\Auth\Basic $true > > $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> > > > I've been stuck on this for ages; what am I doing wrong? > > All I want to do is get my password; but no matter what - it always just > hangs on "Password not available yet." forever. 5 minutes, 10 minutes, 5 > days. > > Follow-up question: > 1) Why do I need a user-data script; why is this not just baked in? Every > time I touch Windows it's jumping hoop after hoop. > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/1516be5e-562b-44ad-8c34-a6bdbbe17ba9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
