Тайм-аут упаковщика при подключении WinRM

Описание

Я пытаюсь автоматизировать создание "золотого образа" Windows Server 2016 с помощью Packer (vmware-iso builder) и vSphere. Виртуальная машина успешно создана, файл autounattend.xml успешно работает, а виртуальная машина выполняет все первые действия по перезагрузке. После этого виртуальная машина / упаковщик находится в состоянии "Ожидание, пока WinRM станет доступным...", пока не истечет время ожидания.

ПРИМЕЧАНИЕ. Мы используем только статические IP-адреса. Нет DHCP.

Упаковщик => 1.3.4

vSphere => 6,5

vmware-iso builder => последний

Фон

Я гарантировал, что:

  1. "Guest ip hack" был реализован.
    • esxcli system settings advanced set -o /Net/GuestIPHack -i 1
  2. Порты VNC 5900-6000 открыты.
  3. SSH включен.
  4. Я могу подключиться через winrm с сервера, на котором работает упаковщик, к виртуальной машине вручную через PowerShell.
  5. Используемые учетные данные верны.
  6. Тип network_adapter_type установлен на VMXNET3.
  7. Инструменты VMware установлены.

Упаковщик JSON

{
    "variables": {
        "name": "",
        "vm_name": "",
        "guest_os_type": "",
        "tools_upload_flavor": "",
        "headless": "false",
        "iso_url": "",
        "iso_checksum": "",
        "iso_checksum_type": "",
        "disk_size": "60000",
        "admin_user": "",
        "admin_password": "",
        "memsize": "4096",
        "numvcpus": "2",
        "network_name": "",
        "vsphere_server": "",
        "vsphere_user": "",
        "vsphere_pass": "",
        "vsphere_datastore": ""
    },
    "builders": [
        {
            "name": "{{user `name`}}",
            "vm_name": "{{user `vm_name`}}",
            "keep_registered": false,
            "ovftool_options": [
                "--noSSLVerify"
            ],
            "type": "vmware-iso",
            "guest_os_type": "{{user `guest_os_type`}}",
            "tools_upload_flavor": "{{user `tools_upload_flavor`}}",
            "headless": "{{user `headless`}}",
            "boot_wait": "1m",
            "iso_url": "{{user `iso_url`}}",
            "iso_checksum": "{{user `iso_checksum`}}",
            "iso_checksum_type": "{{user `iso_checksum_type`}}",
            "disk_size": "{{user `disk_size`}}",
            "floppy_files": [
                "./2016/resources/autounattend.xml",
                "./2016/resources/feature-reset.ps1",
                "./2016/resources/postinstall.xml",
                "./common/configure-winrm.ps1",
                "./common/configure-ip.ps1",
                "./common/configure-domain.ps1",
                "./common/install-vmware-tools.ps1"
            ],
            "vnc_disable_password": true,
            "communicator": "winrm",
            "winrm_insecure": true,
            "winrm_username": "{{user `admin_user`}}",
            "winrm_password": "{{user `admin_password`}}",
            "winrm_timeout": "6h",
            "shutdown_command": "C:/windows/system32/sysprep/sysprep.exe /generalize /oobe /unattend:A:/postinstall.xml /quiet /shutdown",
            "remote_type": "esx5",
            "remote_host": "{{user `vsphere_server`}}",
            "remote_password": "{{user `vsphere_pass`}}",
            "remote_username": "{{user `vsphere_user`}}",
            "remote_datastore": "{{user `vsphere_datastore`}}",
            "skip_compaction": false,
            "network_adapter_type": "VMXNET3",
            "vmx_data": {
                "gui.fitguestusingnativedisplayresolution": false,
                "memsize": "{{user `memsize`}}",
                "numvcpus": "{{user `numvcpus`}}",
                "virtualhw.productcompatibility": "esx",
                "virtualHW.version": 10,
                "scsi0.virtualDev": "lsisas1068",
                "ethernet0.networkName": "{{user `network_name`}}"
            },
            "vmx_data_post": {
                "ide0:0.startConnected": false,
                "ide0:1.startConnected": false,
                "ide1:0.startConnected": false,
                "ide1:1.startConnected": false,
                "ide0:0.deviceType": "cdrom-raw",
                "ide0:1.deviceType": "cdrom-raw",
                "ide1:0.deviceType": "cdrom-raw",
                "ide1:1.deviceType": "cdrom-raw",
                "ide0:0.clientDevice": true,
                "ide0:1.clientDevice": true,
                "ide1:0.clientDevice": true,
                "ide1:1.clientDevice": true,
                "ide0:0.present": false,
                "ide0:1.present": false,
                "ide1:0.present": true,
                "ide1:1.present": false,
                "ide0:0.fileName": "emptyBackingString",
                "ide0:1.fileName": "emptyBackingString",
                "ide1:0.fileName": "emptyBackingString",
                "ide1:1.fileName": "emptyBackingString"
            }
        }
    ]
}

Выход

==> win-server-2016-template: Retrieving ISO
    win-server-2016-template: Found already downloaded, initial checksum matched, no download needed: https://software-download.microsoft.com/download/pr/Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO
==> win-server-2016-template: Creating floppy disk...
    win-server-2016-template: Copying files flatly from floppy_files
    win-server-2016-template: Copying file: ./2016/resources/autounattend.xml
    win-server-2016-template: Copying file: ./2016/resources/feature-reset.ps1
    win-server-2016-template: Copying file: ./2016/resources/postinstall.xml
    win-server-2016-template: Copying file: ./common/configure-winrm.ps1
    win-server-2016-template: Copying file: ./common/configure-ip.ps1
    win-server-2016-template: Copying file: ./common/configure-domain.ps1
    win-server-2016-template: Copying file: ./common/install-vmware-tools.ps1
    win-server-2016-template: Done copying files from floppy_files
    win-server-2016-template: Collecting paths from floppy_dirs
    win-server-2016-template: Resulting paths from floppy_dirs : []
    win-server-2016-template: Done copying paths from floppy_dirs
==> win-server-2016-template: Uploading Floppy to remote machine...
==> win-server-2016-template: Remote cache was verified skipping remote upload...
==> win-server-2016-template: Creating required virtual machine disks
==> win-server-2016-template: Building and writing VMX file
==> win-server-2016-template: Registering remote VM...
==> win-server-2016-template: Starting virtual machine...
==> win-server-2016-template: Waiting 1m0s for boot...
==> win-server-2016-template: Connecting to VM via VNC (esxihost.domain.com:5900)
==> win-server-2016-template: Typing the boot command over VNC...
==> win-server-2016-template: Waiting for WinRM to become available...

Журнал отладки

2019/02/12 00:45:50 packer.exe: 2019/02/12 00:45:50 [DEBUG] Opening new ssh session
2019/02/12 00:45:50 packer.exe: 2019/02/12 00:45:50 [DEBUG] starting remote command: esxcli --formatter csv network vm list
2019/02/12 00:45:51 packer.exe: 2019/02/12 00:45:51 [DEBUG] Error getting WinRM host: EOF
2019/02/12 00:45:56 packer.exe: 2019/02/12 00:45:56 [DEBUG] Opening new ssh session
2019/02/12 00:45:56 packer.exe: 2019/02/12 00:45:56 [DEBUG] starting remote command: esxcli --formatter csv network vm list
2019/02/12 00:45:56 packer.exe: 2019/02/12 00:45:56 [DEBUG] Error getting WinRM host: EOF
2019/02/12 00:46:01 packer.exe: 2019/02/12 00:46:01 [DEBUG] Opening new ssh session
2019/02/12 00:46:01 packer.exe: 2019/02/12 00:46:01 [DEBUG] starting remote command: esxcli --formatter csv network vm list
2019/02/12 00:46:02 packer.exe: 2019/02/12 00:46:02 [DEBUG] Error getting WinRM host: EOF

Полный лог-файл.

Обновить

Похоже, это проблема упаковщика, который не может получить IP-адрес от хоста ESXi (Error getting WinRM host: EOF).

0 ответов

Другие вопросы по тегам