Deploy RockyLinux no Vshpere 7

34 views
Skip to first unread message

paulo rosa

unread,
Jul 16, 2022, 6:55:06 PMJul 16
to Packer

I need Help

Im try make deploy the rockylinux in vshpere 7. but with errors.  The network where  it will be done deploy not have server dhcp, need pass the ip during the boot through packer.  But dont sknow make it that.  I'm used the comand line  below for pass the ip   through packer for vm.

boot_command = [
"<tab><bs><bs><bs><bs><bs> inst.ks ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg nameserver=192.168.8.30 gateway=192.168.8.30 ip=192.168.8.48 netmask=255.255.255.192 <enter><wait>",
 ]


my conf file used for boot:   vsphere.pkr.hcl

source "vsphere-iso" "this" {
 vcenter_server      = var.vsphere_server
 username            = var.vsphere_user
 password            = var.vsphere_password
 datacenter          = var.datacenter
 cluster             = var.cluster
 insecure_connection = true
 http_directory      = "http"
 //convert_to_template = true

 vm_name             = "ip-static"
 guest_os_type       = "centos7_64guest"

 ssh_username        = "packer"
 ssh_password        = "packer"
 ssh_port            = "22"
 ssh_timeout         = "30m"

 CPUs                = 4
 RAM                 = 4096
 RAM_reserve_all     = true

 disk_controller_type =  ["lsilogic-sas"]
 datastore = var.datastore
 storage {
   disk_size = 20000
   disk_thin_provisioned = true
 }

 iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.0-x86_64-minimal.iso"
 //iso_paths = ["[datastore1] Iso/Rocky-8.6-x86_64-minimal.iso"]
 iso_checksum = "sha256:dbe7ee3000baa22ebfc7d66611597081c6b3e792a8c0c86a5a9d58e14650d874"

 network_adapters {
   network =  var.network_name
   network_card = "vmxnet3"
 }

 //boot_command = [
 //"<tab><bs><bs><bs><bs><bs>text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>",
 //]
  
 //floppy_files = ["http/ks.cfg"]
 //boot_command = [
 //"<tab><bs><bs><bs><bs><bs>text inst.ks ks=hd:fd0:/ks.cfg<enter><wait>"
 // ]
  
 boot_command = [
"<tab><bs><bs><bs><bs><bs> inst.ks ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg nameserver=192.168.8.30 gateway=192.168.8.30 ip=192.168.8.48 netmask=255.255.255.192 <enter><wait>",
 ]
}

build {
 sources  = [
   "source.vsphere-iso.this"
 ]

provisioner "shell-local" {
   inline  = ["echo the address is: $PACKER_HTTP_ADDR and build name is: $PACKER_BUILD_NAME"]
 }
}



Errors duraning the boot process

2022/07/16 14:32:31 packer-builder-vsphere-iso plugin: Found available port: 8042 on IP: 0.0.0.0
==> vsphere-iso.this: Starting HTTP server on port 8042
==> vsphere-iso.this: Set boot order temporary...
==> vsphere-iso.this: Power on VM...
==> vsphere-iso.this: Waiting 10s for boot...
==> vsphere-iso.this: HTTP server is working at http://192.168.8.4:8042/
==> vsphere-iso.this: Typing boot command...
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Special code '<tab>' found, replacing with: CodeTab
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Special code '<bs>' found, replacing with: CodeDeleteBackspace
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Special code '<bs>' found, replacing with: CodeDeleteBackspace
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Special code '<bs>' found, replacing with: CodeDeleteBackspace
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Special code '<bs>' found, replacing with: CodeDeleteBackspace
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Special code '<bs>' found, replacing with: CodeDeleteBackspace
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Sending char 't', code CodeT, shift false
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Sending char 'e', code CodeE, shift false
2022/07/16 14:32:48 packer-builder-vsphere-iso plugin: Sending char 'x', code CodeX, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char 't', code CodeT, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char ' ', code CodeSpacebar, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char 'i', code CodeI, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char 'n', code CodeN, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char 's', code CodeS, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char 't', code CodeT, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char '.', code CodeFullStop, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char 'k', code CodeK, shift false
2022/07/16 14:32:49 packer-builder-vsphere-iso plugin: Sending char 's', code CodeS, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char ' ', code CodeSpacebar, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char 'k', code CodeK, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char 's', code CodeS, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char '=', code CodeEqualSign, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char 'h', code CodeH, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char 'd', code CodeD, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char ':', code CodeSemicolon, shift true
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char 'f', code CodeF, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char 'd', code CodeD, shift false
2022/07/16 14:32:50 packer-builder-vsphere-iso plugin: Sending char '0', code Code0, shift false
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Sending char ':', code CodeSemicolon, shift true
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Sending char '/', code CodeSlash, shift false
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Sending char 'k', code CodeK, shift false
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Sending char 's', code CodeS, shift false
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Sending char '.', code CodeFullStop, shift false
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Sending char 'c', code CodeC, shift false
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Sending char 'f', code CodeF, shift false
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Sending char 'g', code CodeG, shift false
2022/07/16 14:32:51 packer-builder-vsphere-iso plugin: Special code '<enter>' found, replacing with: CodeReturnEnter
2022/07/16 14:32:52 packer-builder-vsphere-iso plugin: [INFO] Waiting 1s
2022/07/16 14:32:53 packer-builder-vsphere-iso plugin: [INFO] Waiting for IP, up to total timeout: 30m0s, settle timeout: 5s
==> vsphere-iso.this: Waiting for IP...
==> vsphere-iso.this: Timeout waiting for IP.
==> vsphere-iso.this: Clear boot order...
==> vsphere-iso.this: Power off VM...
==> vsphere-iso.this: Deleting Floppy image ...
2022/07/16 15:02:56 packer-builder-vsphere-iso plugin: Deleting floppy disk: /tmp/packer3530382461
==> vsphere-iso.this: Destroying VM...
2022/07/16 15:02:59 [INFO] (telemetry) ending vsphere-iso.this
==> Wait completed after 30 minutes 37 seconds
2022/07/16 15:02:59 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
Build 'vsphere-iso.this' errored after 30 minutes 37 seconds: Timeout waiting for IP.
2022/07/16 15:02:59 machine readable: vsphere-iso.this,error []string{"Timeout waiting for IP."}
==> Builds finished but no artifacts were created.

2022/07/16 15:02:59 [INFO] (telemetry) Finalizing.
==> Wait completed after 30 minutes 37 seconds

==> Some builds didn't complete successfully and had errors:
--> vsphere-iso.this: Timeout waiting for IP.


Reply all
Reply to author
Forward
0 new messages