使用与“packer_user"不同的 winrm 用户的问题使用谷歌云平台 [英] Issue with using winrm user different from "packer_user" with Google Cloud Platform

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

问题描述

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

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.

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

有人遇到过这种情况吗?

Has anyone faced with such case?

问候,伊尔

推荐答案

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 用户的问题使用谷歌云平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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