使用不同于"packer_user"的winrm用户的问题使用Google Cloud Platform [英] Issue with using winrm user different from "packer_user" with Google Cloud Platform

查看:79
本文介绍了使用不同于"packer_user"的winrm用户的问题使用Google Cloud Platform的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用包装机1.4.3时遇到问题.起初,我遇到了一个问题,该问题在#8085( https://circleci.com/gh/hashicorp/packer/12207#artifacts/containers/0 版本).通过下载提到的打包程序版本已成功修复该问题.

I faced an issue using packer 1.4.3. At first I faced an issue, which described in #8085 (https://circleci.com/gh/hashicorp/packer/12207#artifacts/containers/0 version) . It was successfully fixed with downloading mentioned packer version.

当前,我正在使用打包程序在Google Cloud Platform中构建Windows-2019和Windows-2016.当我提到"winrm_username":"packer_user"时,它以正确的方式工作,如果我使用"winrm_username":"Adminitstator"或"winrm_username":"administator",则出现以下错误:

Currently I'm building Windows-2019 and Windows-2016 in Google Cloud Platform with packer. It works in proper way when I mention "winrm_username": "packer_user", if I use "winrm_username": "Adminitstator" or "winrm_username": "administator", I have an error below:

==> Windows-2019:等待实例开始运行... Windows-2019:内部IP:10.154.21.58 Windows-2019:IP:10.154.21.58==> Windows-2019:使用Winrm通信器进行连接:10.154.21.58==> Windows-2019:等待WinRM可用...==> Windows-2019:等待WinRM超时.==> Windows-2019:删除实例... Windows-2019:实例已删除!==> Windows-2019:删除磁盘... Windows-2019:磁盘已删除!生成"windows-2019"错误:等待WinRM超时.

==> windows-2019: Waiting for the instance to become running... windows-2019: Internal IP: 10.154.21.58 windows-2019: IP: 10.154.21.58 ==> windows-2019: Using winrm communicator to connect: 10.154.21.58 ==> windows-2019: Waiting for WinRM to become available... ==> windows-2019: Timeout waiting for WinRM. ==> windows-2019: Deleting instance... windows-2019: Instance has been deleted! ==> windows-2019: Deleting disk... windows-2019: Disk has been deleted! Build 'windows-2019' errored: Timeout waiting for WinRM.

我还尝试为等待的实例"winrm_timeout"添加超时:"7m"

I've also tried to add timeout for waiting instance "winrm_timeout":"7m"

下面您可以找到我的用于使用打包程序构建Windows图像的json文件:

Below you can find my json file for building windows image with packer:

{
"name": "windows-2016",
"type": "googlecompute",
"project_id": "myProject",
"zone": "{{user zone}}",
"source_image_family": "windows-2016",
"communicator": "winrm",
"winrm_username": "Adminitstrator",
"image_name": "test-image",
"machine_type": "n1-standard-2",
"disk_size": 50,
"network_project_id": "build-test",
"subnetwork": "mynetwork",
"omit_external_ip": true,
"use_internal_ip": true,
"tags": [
"project-test
],
"winrm_insecure": true,
"winrm_use_ssl": true,
"metadata": {
"windows-startup-script-cmd": "winrm quickconfig -quiet & net user /add Adminitstrator & net localgroup administrators Adminitstrator /add & net user /add Adminitstrator & winrm set winrm/config/service/auth @{Basic="true"}"
}
}

在centos-7上安装了打包程序.

Packer installed on centos-7.

这是packer_log = 1的输出

this is output of packer_log=1

2019/09/24 09:48:31 Build debug mode: true
2019/09/24 09:48:31 Force build: false
2019/09/24 09:48:31 On error: abort
2019/09/24 09:48:31 Preparing build: windows-2016
2019/09/24 09:48:31 Debug enabled, so waiting for build to finish: windows-2016
2019/09/24 09:48:31 Starting build run: windows-2016
2019/09/24 09:48:31 Running builder: googlecompute
2019/09/24 09:48:31 [INFO] (telemetry) Starting builder googlecompute
2019/09/24 09:48:31 packer: 2019/09/24 09:48:31 [INFO] Requesting Google token via GCE API Default Client Token Source...
2019/09/24 09:48:31 packer: 2019/09/24 09:48:31 [INFO] Instantiating GCE client...
2019/09/24 09:48:32 packer: 2019/09/24 09:48:32 Error asking for input: no available tty
2019/09/24 09:48:32 packer: 2019/09/24 09:48:32 Error asking for input: no available tty
2019/09/24 09:48:38 packer: 2019/09/24 09:48:38 Retryable error: retrying for state DONE, got RUNNING
2019/09/24 09:48:40 packer: 2019/09/24 09:48:40 Retryable error: retrying for state DONE, got RUNNING
2019/09/24 09:48:43 packer: 2019/09/24 09:48:43 Error asking for input: no available tty
2019/09/24 09:48:44 packer: 2019/09/24 09:48:44 Retryable error: retrying for state DONE, got RUNNING
2019/09/24 09:48:46 packer: 2019/09/24 09:48:46 Retryable error: retrying for state DONE, got RUNNING
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 Error asking for input: no available tty
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 Error asking for input: no available tty
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 Waiting for WinRM, up to timeout: 30m0s
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 [INFO] Attempting WinRM connection...
2019/09/24 09:49:24 packer: 2019/09/24 09:49:24 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:49:54 packer: 2019/09/24 09:49:54 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:49:54 packer: 2019/09/24 09:49:54 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:49:54 packer: 2019/09/24 09:49:54 [INFO] Attempting WinRM connection...
2019/09/24 09:49:54 packer: 2019/09/24 09:49:54 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:50:24 packer: 2019/09/24 09:50:24 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:50:24 packer: 2019/09/24 09:50:24 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:50:24 packer: 2019/09/24 09:50:24 [INFO] Attempting WinRM connection...
2019/09/24 09:50:24 packer: 2019/09/24 09:50:24 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:50:54 packer: 2019/09/24 09:50:54 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:50:54 packer: 2019/09/24 09:50:54 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:50:54 packer: 2019/09/24 09:50:54 [INFO] Attempting WinRM connection...
2019/09/24 09:50:54 packer: 2019/09/24 09:50:54 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:51:24 packer: 2019/09/24 09:51:24 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:51:24 packer: 2019/09/24 09:51:24 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:51:24 packer: 2019/09/24 09:51:24 [INFO] Attempting WinRM connection...
2019/09/24 09:51:24 packer: 2019/09/24 09:51:24 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:51:54 packer: 2019/09/24 09:51:54 [ERROR] connection error: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:51:54 packer: 2019/09/24 09:51:54 [ERROR] WinRM connection err: unknown error Post https://10.154.21.194:5986/wsman: dial tcp 10.154.21.194:5986: i/o timeout
2019/09/24 09:51:54 packer: 2019/09/24 09:51:54 [INFO] Attempting WinRM connection...
2019/09/24 09:51:54 packer: 2019/09/24 09:51:54 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:09 packer: 2019/09/24 09:52:09 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:09 packer: 2019/09/24 09:52:09 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:09 packer: 2019/09/24 09:52:09 [INFO] Attempting WinRM connection...
2019/09/24 09:52:09 packer: 2019/09/24 09:52:09 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [INFO] Attempting WinRM connection...
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [INFO] Attempting WinRM connection...
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [INFO] Attempting WinRM connection...
2019/09/24 09:52:10 packer: 2019/09/24 09:52:10 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [INFO] Attempting WinRM connection...
2019/09/24 09:52:11 packer: 2019/09/24 09:52:11 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [ERROR] WinRM connection err: http response error: 401 - invalid content type
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [INFO] Attempting WinRM connection...
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [DEBUG] connecting to remote shell using WinRM
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [ERROR] connection error: http response error: 401 - invalid content type
2019/09/24 09:52:12 packer: 2019/09/24 09:52:12 [ERROR] WinRM connection err: http response error: 401 - invalid content type

有人遇到这种情况吗?

关于,伊霍尔(Ihor)

Regards, Ihor

推荐答案

GCP提供的Windows映像已经有一个名为 Administrator 的本地用户,但默认情况下处于禁用状态.因此,使用 Administrator 以外的用户名是正确的方法.

The Windows images that GCP provides already have a local user named Administrator, but it is disabled by default. Using a user name other than Administrator is therefore the right way to go.

这篇关于使用不同于"packer_user"的winrm用户的问题使用Google Cloud Platform的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆