From c9e016586df2886f6e0ff702656ab072cde207d5 Mon Sep 17 00:00:00 2001 From: John Bowdre Date: Sun, 4 Dec 2022 17:37:00 -0600 Subject: [PATCH] cleanup and reorg --- packer/scripts/configure-sshd.sh | 1 - packer/scripts/install-ca-certs.sh | 2 - packer/scripts/install-k8s.sh | 1 - packer/ubuntu-k8s.example.pkrvars.hcl | 103 +++++++++++--------------- 4 files changed, 45 insertions(+), 62 deletions(-) diff --git a/packer/scripts/configure-sshd.sh b/packer/scripts/configure-sshd.sh index 84ff4af..8d2f77f 100644 --- a/packer/scripts/configure-sshd.sh +++ b/packer/scripts/configure-sshd.sh @@ -3,4 +3,3 @@ echo '>> Configuring SSH' sudo sed -i 's/.*PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config sudo sed -i 's/.*PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config sudo sed -i 's/.*PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config - diff --git a/packer/scripts/install-ca-certs.sh b/packer/scripts/install-ca-certs.sh index de65787..8116452 100644 --- a/packer/scripts/install-ca-certs.sh +++ b/packer/scripts/install-ca-certs.sh @@ -1,5 +1,4 @@ #!/bin/bash -eu - echo '>> Installing custom certificates...' sudo cp /tmp/certs/* /usr/local/share/ca-certificates/ cd /usr/local/share/ca-certificates/ @@ -7,4 +6,3 @@ for file in *.cer; do sudo mv -- "$file" "${file%.cer}.crt" done sudo /usr/sbin/update-ca-certificates - diff --git a/packer/scripts/install-k8s.sh b/packer/scripts/install-k8s.sh index 2933e13..7ac9e7e 100644 --- a/packer/scripts/install-k8s.sh +++ b/packer/scripts/install-k8s.sh @@ -1,5 +1,4 @@ #!/bin/bash -eu - chmod 600 ~/.ssh/id_ed25519 echo ">> Installing Kubernetes components..." diff --git a/packer/ubuntu-k8s.example.pkrvars.hcl b/packer/ubuntu-k8s.example.pkrvars.hcl index 9f959c5..ad39fc6 100644 --- a/packer/ubuntu-k8s.example.pkrvars.hcl +++ b/packer/ubuntu-k8s.example.pkrvars.hcl @@ -3,12 +3,39 @@ Ubuntu Server 20.04 LTS Kubernetes node variables used by the Packer Plugin for VMware vSphere (vsphere-iso). */ -// Default Account Credentials -build_username = "admin" -build_password = "VMware1!" -build_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOpLvpxilPjpCahAQxs4RQgv+Lb5xObULXtwEoimEBpA builder" +// vSphere Credentials +vsphere_endpoint = "vcenter.lab.local" +vsphere_username = "packer" +vsphere_password = "VMware1!" +vsphere_insecure_connection = true -// Virtual Machine Settings +// vSphere Settings +vsphere_datacenter = "Datacenter 01" +vsphere_cluster = "cluster-01" +vsphere_datastore = "datastore-01" +vsphere_network = "network-01" +vsphere_folder = "_Templates" + +// Guest Operating System Settings +vm_guest_os_language = "en_US" +vm_guest_os_keyboard = "us" +vm_guest_os_timezone = "America/Chicago" +vm_guest_os_family = "linux" +vm_guest_os_type = "ubuntu64Guest" + +// Virtual Machine Hardware Settings +vm_name = "k8s-u2004" +vm_firmware = "efi-secure" +vm_cdrom_type = "sata" +vm_cpu_count = 2 +vm_cpu_cores = 1 +vm_cpu_hot_add = true +vm_mem_size = 2048 +vm_mem_hot_add = true +vm_disk_size = 30720 +vm_disk_controller_type = ["pvscsi"] +vm_disk_thin_provisioned = true +vm_network_card = "vmxnet3" common_vm_version = 19 common_tools_upgrade_policy = true common_remove_cdrom = true @@ -27,53 +54,11 @@ common_ovf_export_path = "" // Removable Media Settings common_iso_datastore = "datastore-01" - -// Boot and Provisioning Settings -common_ip_wait_timeout = "20m" -common_shutdown_timeout = "15m" - -// vSphere Credentials -vsphere_endpoint = "vcenter.lab.local" -vsphere_username = "packer" -vsphere_password = "VMware1!" -vsphere_insecure_connection = true - -// vSphere Settings -vsphere_datacenter = "Datacenter 01" -vsphere_cluster = "cluster-01" -vsphere_datastore = "datastore-01" -vsphere_network = "network-01" -vsphere_folder = "_Templates" - -// Guest Operating System Metadata -vm_guest_os_language = "en_US" -vm_guest_os_keyboard = "us" -vm_guest_os_timezone = "America/Chicago" -vm_guest_os_family = "linux" - -// Virtual Machine Guest Operating System Setting -vm_guest_os_type = "ubuntu64Guest" - -// Virtual Machine Hardware Settings -vm_name = "k8s-u2004" -vm_firmware = "efi-secure" -vm_cdrom_type = "sata" -vm_cpu_count = 2 -vm_cpu_cores = 1 -vm_cpu_hot_add = true -vm_mem_size = 2048 -vm_mem_hot_add = true -vm_disk_size = 30720 -vm_disk_controller_type = ["pvscsi"] -vm_disk_thin_provisioned = true -vm_network_card = "vmxnet3" - -// Removable Media Settings -iso_url = null -iso_path = "_ISO" -iso_file = "ubuntu-20.04.5-live-server-amd64.iso" -iso_checksum_type = "sha256" -iso_checksum_value = "5035be37a7e9abbdc09f0d257f3e33416c1a0fb322ba860d42d74aa75c3468d4" +iso_url = null +iso_path = "_ISO" +iso_file = "ubuntu-20.04.5-live-server-amd64.iso" +iso_checksum_type = "sha256" +iso_checksum_value = "5035be37a7e9abbdc09f0d257f3e33416c1a0fb322ba860d42d74aa75c3468d4" // Boot Settings vm_boot_order = "disk,cdrom" @@ -89,9 +74,14 @@ vm_boot_command = [ ] // Communicator Settings -communicator_port = 22 -communicator_timeout = "20m" -build_remove_keys = false +communicator_port = 22 +communicator_timeout = "20m" +common_ip_wait_timeout = "20m" +common_shutdown_timeout = "15m" +build_remove_keys = false +build_username = "admin" +build_password = "VMware1!" +build_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOpLvpxilPjpCahAQxs4RQgv+Lb5xObULXtwEoimEBpA builder" // Provisioner Settings post_install_scripts = [ @@ -115,6 +105,3 @@ pre_final_scripts = [ // Kubernetes Settings k8s_version = "1.25.3" - - -