首页 > 解决方案 > 打包机 - Vsphere-iso - Centos 8

问题描述

我正在使用以下 JSON 和 KS.cfg 来构建 centos 8 模板。但面临软盘错误(未在配置中使用)。已尝试更改启动顺序,但没有运气。也没有找到用于 vsphere-iso 构建器的 centos 8 Json 的示例。有人可以帮我弄这个吗?

CentOS 8 JSON

{
  "variables": {
   "vsphere_uid": "Null",
   "vsphere_passwd": "Null",
   "vm_superuser_passwd" : "Null",
   "vsphere_vm_name": "Null",
   "bastion_host": "",
   "bastion_user": "",
   "bastion_password":"Null",
   "datacenter": "",
   "cluster": "",
   "datastore": "",
   "network": "",
   "iso_paths": ""
   },

  "builders": [
    {
      "type": "vsphere-iso",

      "vcenter_server":      "{{user `vsphere_server` }}",
      "username":            "{{user `vsphere_uid` }}",
      "password":            "{{user `vsphere_passwd` }}",
      "insecure_connection": "true",
      "datacenter": "{{user `datacenter` }}",
      "cluster": "{{user `cluster` }}",
      "datastore": "{{user `datastore` }}",
      "network": "{{user `network` }}",
      "vm_name": "{{user `vsphere_vm_name` }}",

      "guest_os_type": "centos7_64Guest",

      "ssh_username": "admin",
      "ssh_password": "{{user `vm_superuser_passwd` }}",
      "ssh_bastion_host": "{{user `bastion_host` }}",
      "ssh_bastion_username": "{{user `bastion_user` }}",
      "ssh_bastion_agent_auth": true,

      "CPUs":             2,
      "RAM":              5120,
      "RAM_reserve_all": false,

      "convert_to_template": true,

      "disk_controller_type":  "pvscsi",
      "disk_size":        102400,
      "disk_thin_provisioned": true,
      "network_card": "vmxnet3",
      "http_directory" :  "httpks",
      "iso_paths": [
        "[nfs] centos/CentOS-8.2.2004-x86_64-minimal.iso"
      ],
      "iso_checksum": "e15fb0e51726de0a4128448b9bd63e7b",
      "iso_checksum_type": "md5",
      "boot_command": "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg <enter><wait>"
          }
  ]

}

错误是:

dracut-pre-udev{585}: modprobe: FATAL: Module floppy not found in directory /lib/modules/4.18.0-193.2l8.x86_64

— 
2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepConfigParams'. Press enter to continue. 
2020/09/17 05:17:40 packer-builder-vsphere-iso.linux: 
2020/09/17 05:17:40 No floppy files specified. Floppy disk will not be made. 
2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepCreateFloppy'. Press enter to continue. 
2020/09/17 05:17:40 ui: ask: ==> vsphere-iso: Pausing after run of step 'StepAddFloppy'. Press enter to continue.
 — Dracut-initqueue: warning : could not boot Entering Emergency mode. 


请协助

标签: packer-builder

解决方案


工作 cdrom 替代使用cd_files

https://www.packer.io/docs/builders/vmware/vsphere-iso#cd_files

packer 1.6.6

相关片段

...
"type": "vsphere-iso",
"guest_os_type": "centos8_64Guest",
"cd_files": [
    "{{template_dir}}/ks.cfg",
],
"boot_command": [
    '<up>'
    'e',
    '<down><down><end><wait>',
    ' text ks=cdrom:/dev/sr1:/ks.cfg'
    '<leftCtrlOn>x<leftCtrlOff>',
],
...

推荐阅读