I seem to have made it past the above problem by added winrm_password to 
the build.  

This is back to where I have been stuck all along now, waiting for winrm???

==> amazon-ebs: Force Deregister flag found, skipping prevalidating AMI Name
    amazon-ebs: Found Image ID: ami-0eb7fbcc77e5e6ec6
==> amazon-ebs: Creating temporary keypair: 
packer_5f722e4c-5acb-dd97-e2bc-3d2748cc83df
==> amazon-ebs: Creating temporary security group for this instance: 
packer_5f722e4e-875f-3fe7-a2f0-104cb20e0fbf
==> amazon-ebs: Authorizing access to port 5986 from [0.0.0.0/0] in the 
temporary security groups...
==> amazon-ebs: Launching a source AWS instance...
==> amazon-ebs: Adding tags to source instance
    amazon-ebs: Adding tag: "Name": "Packer Builder"
    amazon-ebs: Instance ID: i-07fd947bd9857679f
==> amazon-ebs: Waiting for instance (i-07fd947bd9857679f) to become 
ready...
==> amazon-ebs: Skipping waiting for password since WinRM password set...
==> amazon-ebs: Using winrm communicator to connect: 10.184.21.17
==> amazon-ebs: Waiting for WinRM to become available...

On Monday, September 28, 2020 at 2:12:06 PM UTC-4 i255d wrote:

>
> <powershell>
> # Set administrator password
> net user Administrator SOMETHINGGOOD
> wmic useraccount where "name='Administrator'" set PasswordExpires=FALSE
>
> # First, make sure WinRM can't be connected to
> netsh advfirewall firewall set rule name="Windows Remote Management 
> (HTTP-In)" new enable=yes action=block
>
> # Delete any existing WinRM listeners
> winrm delete winrm/config/listener?Address=*+Transport=HTTP  2>$Null
> winrm delete winrm/config/listener?Address=*+Transport=HTTPS 2>$Null
>
> # Create a new WinRM listener and configure
> winrm create winrm/config/listener?Address=*+Transport=HTTP
> winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="0"}'
> winrm set winrm/config '@{MaxTimeoutms="7200000"}'
> winrm set winrm/config/service '@{AllowUnencrypted="true"}'
> winrm set winrm/config/service '@{MaxConcurrentOperationsPerUser="12000"}'
> winrm set winrm/config/service/auth '@{Basic="true"}'
> winrm set winrm/config/service/auth '@{Certificate="true"}'
> winrm set winrm/config/client/auth '@{Basic="true"}'
> winrm set winrm/config/client/auth '@{Certificate="true"}'
>
> # Configure UAC to allow privilege elevation in remote shells
> $Key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'
> $Setting = 'LocalAccountTokenFilterPolicy'
> Set-ItemProperty -Path $Key -Name $Setting -Value 1 -Force
>
> # Configure and restart the WinRM Service; Enable the required firewall 
> exception
> Stop-Service -Name WinRM
> Set-Service -Name WinRM -StartupType Automatic
> netsh advfirewall firewall set rule name="Windows Remote Management 
> (HTTP-In)" new action=allow localip=any remoteip=any
> Start-Service -Name WinRM
> </powershell>
>
> Here is my user_data.txt file from the line  
> "user_data_file": "scripts/user_data.txt.  
>
> As you can see, I want to be able to use a predetermined password.  
>
>
> ==> amazon-ebs: Force Deregister flag found, skipping prevalidating AMI 
> Name
> 171
> amazon-ebs: Found Image ID: ami-0eb7fbcc77e5e6ec6
> 172
> ==> amazon-ebs: Creating temporary keypair: 
> packer_5f720690-c3aa-4a5b-103b-b244e5cfaf67
> 173
> ==> amazon-ebs: Creating temporary security group for this instance: 
> packer_5f720692-6518-386c-fcfb-64088f3bdde8
> 174
> ==> amazon-ebs: Authorizing access to port 5986 from [0.0.0.0/0] in the 
> temporary security groups...
> 175
> ==> amazon-ebs: Launching a source AWS instance...
> 176
> ==> amazon-ebs: Adding tags to source instance
> 177
> amazon-ebs: Adding tag: "Name": "Packer Builder"
> 178
> amazon-ebs: Instance ID: i-076f324e8ca7a0f28
> 179
> ==> amazon-ebs: Waiting for instance (i-076f324e8ca7a0f28) to become 
> ready...
> 180
> ==> amazon-ebs: Waiting for auto-generated password for instance...
> 181
> amazon-ebs: It is normal for this process to take up to 15 minutes,
> 182
> amazon-ebs: but it usually takes around 5. Please wait.
> 183
> ==> amazon-ebs: Error waiting for password: retry count exhausted. Last 
> err: Error retrieving auto-generated instance password: 
> UnauthorizedOperation: You are not authorized to perform this operation. 
> Encoded authorization failure message:  
> 
>
>
>
> On Monday, September 28, 2020 at 11:57:24 AM UTC-4 i255d wrote:
> {
>   "variables": {
>     "region": "{{env `region`}}",
>     "environment": "{{env `env`}}",
>     "lob": "{{env `lob`}}",
>     "vpc_id": "{{env `vpc_id`}}",
>     "subnet_id": "{{env `subnet_id`}}",
>     "account": "{{env `account`}}",
>     "role": "{{env `iam_instance_profile`}}",
>     "kms_key": "{{env `kms_key_id`}}"
>   },
>   "builders": [
>     {
>       "type": "amazon-ebs",
>       "region": "{{user `region`}}",
>       "vpc_id": "{{user `vpc_id`}}",
>       "subnet_id": "{{user `subnet_id`}}",
>       "instance_type": "t2.medium",
>       "source_ami_filter": {
>         "filters": {
>           "virtualization-type": "hvm",
>           "name": "Windows_Server-2019-English-Full-Base-*",
>           "root-device-type": "ebs"
>         },
>         "most_recent": true,
>         "owners": "amazon"
>       },
>       "ami_name": "test-ansible-packer",
>       "user_data_file": "scripts/user_data.txt",
>       "communicator": "winrm",
>       "force_deregister": true,
>       "winrm_insecure": true,
>       "winrm_username": "Administrator",
>       "winrm_use_ssl": true,
>       "iam_instance_profile": "{{user `role`}}",
>       "skip_profile_validation" : true
>     }
>   ],
>   "provisioners": [
>     {
>       "type": "ansible",
>       "playbook_file": "./playbook.yml",
>       "user": "Administrator",
>       "use_proxy": false,
>
>       "extra_arguments": ["-e", "ansible_winrm_server_cert_validation=ignore"]
>     }
>   ]
> }
> Here is my win2019.json file.
>
>
> On Monday, September 28, 2020 at 11:57:24 AM UTC-4 i255d wrote:
>
>> {
>>   "variables": {
>>     "region": "{{env `region`}}",
>>     "environment": "{{env `env`}}",
>>     "lob": "{{env `lob`}}",
>>     "vpc_id": "{{env `vpc_id`}}",
>>     "subnet_id": "{{env `subnet_id`}}",
>>     "account": "{{env `account`}}",
>>     "role": "{{env `iam_instance_profile`}}",
>>     "kms_key": "{{env `kms_key_id`}}"
>>   },
>>   "builders": [
>>     {
>>       "type": "amazon-ebs",
>>       "region": "{{user `region`}}",
>>       "vpc_id": "{{user `vpc_id`}}",
>>       "subnet_id": "{{user `subnet_id`}}",
>>       "instance_type": "t2.medium",
>>       "source_ami_filter": {
>>         "filters": {
>>           "virtualization-type": "hvm",
>>           "name": "Windows_Server-2019-English-Full-Base-*",
>>           "root-device-type": "ebs"
>>         },
>>         "most_recent": true,
>>         "owners": "amazon"
>>       },
>>       "ami_name": "test-ansible-packer",
>>       "user_data_file": "scripts/user_data.txt",
>>       "communicator": "winrm",
>>       "force_deregister": true,
>>       "winrm_insecure": true,
>>       "winrm_username": "Administrator",
>>       "winrm_use_ssl": true,
>>       "iam_instance_profile": "{{user `role`}}",
>>       "skip_profile_validation" : true
>>     }
>>   ],
>>   "provisioners": [
>>     {
>>       "type": "ansible",
>>       "playbook_file": "./playbook.yml",
>>       "user": "Administrator",
>>       "use_proxy": false,
>>
>>       "extra_arguments": ["-e", 
>> "ansible_winrm_server_cert_validation=ignore"]
>>     }
>>   ]
>> }
>> Here is my win2019.json file.
>>
>>

-- 
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/hashicorp/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/861539e0-a4bb-49fe-8161-4ca1e6e5f32an%40googlegroups.com.

Reply via email to