From dee4f1a22bd9f5d9bc54425197e202d59ec1d57d Mon Sep 17 00:00:00 2001 From: Sergei Bobkov Date: Thu, 19 Sep 2024 22:45:38 +0300 Subject: [PATCH] Correct some mistakes --- packer/README.md | 2 +- packer/build.sh | 0 packer/linux/README.md | 4 ++++ packer/linux/debian-12-x64/conf.pkrvars.hcl | 11 +++------ .../linux/debian-12-x64/debian-12-x64.pkr.hcl | 23 +++++-------------- packer/linux/debian-12-x64/variables.pkr.hcl | 4 ++-- 6 files changed, 16 insertions(+), 28 deletions(-) mode change 100755 => 100644 packer/build.sh diff --git a/packer/README.md b/packer/README.md index c7aa856..c3cae30 100644 --- a/packer/README.md +++ b/packer/README.md @@ -1,2 +1,2 @@ -# Packer scripts +# Packer builds and scripts diff --git a/packer/build.sh b/packer/build.sh old mode 100755 new mode 100644 diff --git a/packer/linux/README.md b/packer/linux/README.md index b342ea5..76e767d 100644 --- a/packer/linux/README.md +++ b/packer/linux/README.md @@ -6,3 +6,7 @@ For secrets and cred vars create $HOME/.secret/.packer/vcsrv-creds.pkrvars.hcl `vcenter_password = "XXXXXXXXX"`

+ +`connection_username = "root"`
+`connection_password = "XXXXXXXX"`
+
diff --git a/packer/linux/debian-12-x64/conf.pkrvars.hcl b/packer/linux/debian-12-x64/conf.pkrvars.hcl index 7a4bfff..b54fcaa 100644 --- a/packer/linux/debian-12-x64/conf.pkrvars.hcl +++ b/packer/linux/debian-12-x64/conf.pkrvars.hcl @@ -4,23 +4,18 @@ vcenter_host = "esxi8-01.lab.loc" vcenter_folder = "VLAN-0221" vcenter_datastore = "Cluster01-LUN02" - -vm_name = "zzzzzzz" +vm_name = "z-test-packer-vm" vm_num_cpu = 1 vm_ram = 1024 -vm_hardware_version = "21" +vm_hardware_version = "20" vm_guest_os_type = "debian12_64Guest" vm_disk_size = "4096" vm_network = "VLAN-0221" vm_network_nic_type = "vmxnet3" - iso_checksum = "none" os_iso_paths = "[Cluster01-LUN01] ISO/debian-12.7.0-amd64-netinst.iso" os_iso_url = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.7.0-amd64-netinst.iso" - - -connection_username = "user" -connection_password = "user" +boot_command = "/install.amd/vmlinuz ipv6.disable=1 auto=true netcfg/dhcp_timeout=30 priority=critical locale=en_US preseed/url=http://aassdd.ru/.my-preseed/debian/preseed.cfg --- initrd=/install.amd/initrd.gz" diff --git a/packer/linux/debian-12-x64/debian-12-x64.pkr.hcl b/packer/linux/debian-12-x64/debian-12-x64.pkr.hcl index 19a202a..8c6a733 100644 --- a/packer/linux/debian-12-x64/debian-12-x64.pkr.hcl +++ b/packer/linux/debian-12-x64/debian-12-x64.pkr.hcl @@ -16,10 +16,10 @@ packer { } } -// BLOCK: locals + // Defines the local variables. //locals { -// bbbbb = "aaaa" +// var1 = "var1" //} source "vsphere-iso" "debian-12" { @@ -49,11 +49,11 @@ source "vsphere-iso" "debian-12" { network_card = var.vm_network_nic_type } // **************** - ip_wait_timeout = "45m" ssh_username = var.connection_username ssh_password = var.connection_password - ssh_timeout = "12h" ssh_port = "22" + ip_wait_timeout = "15m" + ssh_timeout = "10m" ssh_handshake_attempts = "20" shutdown_timeout = "15m" // **************** @@ -63,20 +63,9 @@ source "vsphere-iso" "debian-12" { // **************** boot_wait = "5s" - boot_command = [ - "", - "", - "/install.amd/vmlinuz ", - "ipv6.disable=1 ", - "auto=true ", - "netcfg/dhcp_timeout=30 ", - "priority=critical locale=en_US ", - "preseed/url=http://aassdd.ru/.my-preseed/debian/preseed.cfg ", - "--- ", - "initrd=/install.amd/initrd.gz" - ] -} + boot_command = [var.boot_command] +} build { name = "template" diff --git a/packer/linux/debian-12-x64/variables.pkr.hcl b/packer/linux/debian-12-x64/variables.pkr.hcl index dc98a5e..9ae3697 100644 --- a/packer/linux/debian-12-x64/variables.pkr.hcl +++ b/packer/linux/debian-12-x64/variables.pkr.hcl @@ -1,7 +1,7 @@ variable "vcenter_server" { default = "" - sensitive = true + sensitive = true } variable "vcenter_username" { @@ -59,6 +59,6 @@ variable "connection_username" { default = "" } variable "connection_password" { default = "" } // ************************************ variable "iso_checksum" { default = "" } -variable "os_iso_paths" { default = "" } +variable "os_iso_paths" { default = "" } variable "iso_url" { default = "" } variable "boot_command" { default = "" }