OHHHH! it works. I shuld have much more patience! Thanks for help!
Rickard, i took your config and still have: > > 2017/07/24 10:49:51 packer: 2017/07/24 10:49:51 [DEBUG] connecting to > remote shell using WinRM > 2017/07/24 10:50:21 packer: 2017/07/24 10:50:21 [ERROR] connection error: > unknown error Post https://10.132.0.2:5986/wsman: dial tcp 10.132.0.2:5986: > i/o timeout > 2017/07/24 10:50:21 packer: 2017/07/24 10:50:21 [ERROR] WinRM connection > err: unknown error Post https://10.132.0.2:5986/wsman: dial tcp > 10.132.0.2:5986: i/o timeout > 2017/07/24 10:50:26 packer: 2017/07/24 10:50:26 [INFO] Attempting WinRM > connection... > 2017/07/24 10:50:26 packer: 2017/07/24 10:50:26 [DEBUG] connecting to > remote shell using WinRM > 2017/07/24 10:50:56 packer: 2017/07/24 10:50:56 [ERROR] connection error: > unknown error Post https://10.132.0.2:5986/wsman: dial tcp 10.132.0.2:5986: > i/o timeout > 2017/07/24 10:50:56 packer: 2017/07/24 10:50:56 [ERROR] WinRM connection > err: unknown error Post https://10.132.0.2:5986/wsman: dial tcp > 10.132.0.2:5986: i/o timeout > 2017/07/24 10:51:01 packer: 2017/07/24 10:51:01 [INFO] Attempting WinRM > connection... > 2017/07/24 10:51:01 packer: 2017/07/24 10:51:01 [DEBUG] connecting to > remote shell using WinRM > 2017/07/24 10:51:02 packer: 2017/07/24 10:51:02 [ERROR] connection error: > http response error: 401 - invalid content type > 2017/07/24 10:51:02 packer: 2017/07/24 10:51:02 [ERROR] WinRM connection > err: http response error: 401 - invalid content type > 2017/07/24 10:51:07 packer: 2017/07/24 10:51:07 [INFO] Attempting WinRM > connection... > 2017/07/24 10:51:07 packer: 2017/07/24 10:51:07 [DEBUG] connecting to > remote shell using WinRM > 2017/07/24 10:51:08 packer: 2017/07/24 10:51:08 [ERROR] connection error: > http response error: 401 - invalid content type > 2017/07/24 10:51:08 packer: 2017/07/24 10:51:08 [ERROR] WinRM connection > err: http response error: 401 - invalid content type > 2017/07/24 10:51:13 packer: 2017/07/24 10:51:13 [INFO] Attempting WinRM > connection... > 2017/07/24 10:51:13 packer: 2017/07/24 10:51:13 [DEBUG] connecting to > remote shell using WinRM > 2017/07/24 10:51:15 packer: 2017/07/24 10:51:15 [ERROR] connection error: > http response error: 401 - invalid content type > 2017/07/24 10:51:15 packer: 2017/07/24 10:51:15 [ERROR] WinRM connection > err: http response error: 401 - invalid content type > > only "project_id" and "account_file" was changed... > > Rickard von Essen: >> >> Added ing a working example for HTTPS for reference: >> >> { >> "variables": { >> "startup_script": "winrm quickconfig -quiet & net user /add packer & >> net localgroup administrators packer /add & winrm set >> winrm/config/service/auth @{Basic=\"true\"}" >> }, >> >> "builders": [{ >> "type": "googlecompute", >> "project_id": "packer-test-141600", >> "source_image": "windows-server-2016-dc-v20170711", >> "disk_size": "50", >> "machine_type": "n1-standard-1", >> "zone": "europe-west1-b", >> "network": "default", >> "subnetwork": "default", >> "communicator": "winrm", >> "winrm_username": "packer", >> "winrm_insecure": true, >> "winrm_timeout": "30m", >> "winrm_use_ssl": true, >> "metadata": { "windows-startup-script-cmd": "{{user >> `startup_script`}}" } >> }], >> "provisioners": [{ >> "type": "powershell", >> "inline": [ >> "dir c:\\" >> ] >> }] >> } >> >> >> On 21 July 2017 at 15:22, Alvaro Miranda Aguilera <[email protected]> >> wrote: >> >>> So, seems the 401 cames because Auth basic is not enabled. >>> >>> Can you confirm that got applied? >>> >>> >>> There are the commands that should make it work: >>> >>> winrm set winrm/config/service/Auth '@{Basic="true"}' >>> winrm set winrm/config/service '@{AllowUnencrypted="true"}' >>> winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >>> >>> >>> On Fri, Jul 21, 2017 at 3:12 PM, <[email protected]> wrote: >>> >>>> yep, saw that. it doesn't work for some reason. >>>> Actuay, i don't care about ssl in winRM session, but 401 is really >>>> strange response.. >>>> >>>> Alvaro Miranda Aguilera: >>>>> >>>>> so, did you check this thread? >>>>> >>>>> >>>>> https://groups.google.com/forum/#!topic/packer-tool/oCv78n2jcok >>>>> >>>>> is the firewall open? >>>>> >>>>> where you are running packer need to be able to reach that vm on the >>>>> winrm port >>>>> >>>>> >>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> >>>>> Virusvrij. >>>>> www.avast.com >>>>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> >>>>> >>>>> <#[email protected]_CALz9Rt9k1x_JkxpEC8dzaKUqqmJnc-LztdmHhrHMqY4x_roQQw@mail.gmail.com_m_-2487235044881002364_m_8445387130396579752_CAHqq0exYLoy0su2D+hTtn-UzSsu3HnukasfV612tCfDBeFJMLw@mail.gmail.com_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>>>> >>>>> On Fri, Jul 21, 2017 at 11:22 AM, <[email protected]> wrote: >>>>> >>>>>> I have a trouble with winRM connectivity, my configuration: >>>>>> *{* >>>>>> * "variables": {* >>>>>> * "startup_script": "winrm quickconfig -quiet & net user /add packer >>>>>> & net localgroup administrators packer /add & netsh advfirewall firewall >>>>>> set rule name=\"Windows Remote Management (HTTP-In)\" profile=public new >>>>>> remoteip=any & winrm set winrm/config/service >>>>>> @{AllowUnencrypted=\"true\"} >>>>>> & winrm set winrm/config/service/auth @{Basic=\"true\"} & powershell.exe >>>>>> -NoProfile -ExecutionPolicy Bypass -Command \"Set-ExecutionPolicy >>>>>> -ExecutionPolicy bypass -Force\""* >>>>>> * },* >>>>>> >>>>>> * "builders": [{* >>>>>> * "type": "googlecompute",* >>>>>> * "account_file": "acc.json",* >>>>>> * "project_id": "test-project",* >>>>>> * "source_image": "windows-server-2016-dc-v20170711",* >>>>>> * "disk_size": "50",* >>>>>> * "machine_type": "n1-standard-1",* >>>>>> * "zone": "us-central1-a",* >>>>>> * "network": "default",* >>>>>> * "subnetwork": "default",* >>>>>> * "omit_external_ip": true,* >>>>>> * "use_internal_ip": true,* >>>>>> * "instance_name": "win-base",* >>>>>> * "communicator": "winrm",* >>>>>> * "winrm_username": "packer",* >>>>>> * "winrm_insecure": true,* >>>>>> * "winrm_timeout": "3m",* >>>>>> * "winrm_use_ssl": false,* >>>>>> * "metadata": { "windows-startup-script-cmd": "{{user >>>>>> `startup_script`}}" }* >>>>>> * }],* >>>>>> * "provisioners": [{* >>>>>> * "type": "powershell",* >>>>>> * "inline": [* >>>>>> * "dir c:\\"* >>>>>> * ]* >>>>>> * }]* >>>>>> *}* >>>>>> >>>>>> in logs: >>>>>> >>>>>> 2017/07/21 09:13:20 packer: 2017/07/21 09:13:20 [INFO] Attempting >>>>>> WinRM connection... >>>>>> 2017/07/21 09:13:20 packer: 2017/07/21 09:13:20 [DEBUG] connecting to >>>>>> remote shell using WinRM >>>>>> 2017/07/21 09:13:20 packer: 2017/07/21 09:13:20 [ERROR] connection >>>>>> error: http response error: 401 - invalid content type >>>>>> 2017/07/21 09:13:20 packer: 2017/07/21 09:13:20 [ERROR] WinRM >>>>>> connection err: http response error: 401 - invalid content type >>>>>> >>>>>> when i'm trying to use *"winrm_use_ssl": true, *i recive trouble >>>>>> with *i/o timeout.* >>>>>> >>>>>> But more interesting fact was вiscovered on page >>>>>> https://www.packer.io/docs/provisioners/powershell.html: >>>>>> "The PowerShell Packer provisioner runs PowerShell scripts on Windows >>>>>> machines. It assumes that the communicator in use is WinRM." >>>>>> Which means: if i haven't ready-to-use WinRM - i haven't any >>>>>> provisioning. >>>>>> >>>>>> Could anybody look at the issue? >>>>>> >>>>>> -- >>>>>> 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/8f64ef54-f559-4527-a9cb-8c32028041f1%40googlegroups.com >>>>>> >>>>>> <https://groups.google.com/d/msgid/packer-tool/8f64ef54-f559-4527-a9cb-8c32028041f1%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Alvaro >>>>> >>>>> -- >>>> 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/588c1f51-2e20-4a78-9ff8-4135d9ccbb94%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/packer-tool/588c1f51-2e20-4a78-9ff8-4135d9ccbb94%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Alvaro >>> >>> -- >>> 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/CAHqq0ezyRP1ZK8UCg8BD%3D5d3NOgn-U2%2Br4StgRCRVN%2B5Yj_97g%40mail.gmail.com >>> >>> <https://groups.google.com/d/msgid/packer-tool/CAHqq0ezyRP1ZK8UCg8BD%3D5d3NOgn-U2%2Br4StgRCRVN%2B5Yj_97g%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- 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/ed2f7291-6793-4f7f-adee-cc28f9b61a51%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
