Skip to content

Commit

Permalink
Add Debian/Linux 11 machine image
Browse files Browse the repository at this point in the history
  • Loading branch information
evilaliv3 committed Apr 11, 2022
1 parent e056b0b commit d7aedae
Show file tree
Hide file tree
Showing 6 changed files with 792 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The following builds are available:

**Linux Distributions**
* VMware Photon OS 4
* Debian 11
* Ubuntu Server 22.04 LTS
* Ubuntu Server 20.04 LTS
* Ubuntu Server 18.04 LTS
Expand Down
37 changes: 35 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ follow_link() {
SCRIPT_PATH=$(realpath "$(dirname "$(follow_link "$0")")")
CONFIG_PATH=$(realpath "${1:-${SCRIPT_PATH}/config}")

menu_option_1() {
menu_option_0() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/photon/4/
echo -e "\nCONFIRM: Build a VMware Photon OS 4 Template for VMware vSphere?"
echo -e "\nContinue? (y/n)"
Expand Down Expand Up @@ -50,6 +50,37 @@ menu_option_1() {
echo "Done."
}

menu_option_1() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/debian/11/
echo -e "\nCONFIRM: Build a Debian Bullseye 11 Template for VMware vSphere?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi

### Build a Debian Bullseye 11 Template for VMware vSphere. ###
echo "Building a Debian Bullseye 11 Template for VMware vSphere..."

### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"

### Start the Build. ###
echo "Starting the build...."
packer build -force \
-var-file="$CONFIG_PATH/vsphere.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/ansible.pkrvars.hcl" \
-var-file="$CONFIG_PATH/proxy.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
"$INPUT_PATH"

### All done. ###
echo "Done."
}

menu_option_2() {
INPUT_PATH="$SCRIPT_PATH"/builds/linux/ubuntu/22-04-lts/
echo -e "\nCONFIRM: Build a Ubuntu Server 22.04 LTS Beta Template for VMware vSphere?"
Expand Down Expand Up @@ -721,7 +752,8 @@ until [ "$selection" = "0" ]; do
echo ""
echo " Linux Distribution:"
echo ""
echo " 1 - VMware Photon OS 4"
echo " 0 - VMware Photon OS 4"
echo " 1 - Debian 11"
echo " 2 - Ubuntu Server 22.04 LTS Beta"
echo " 3 - Ubuntu Server 20.04 LTS"
echo " 4 - Ubuntu Server 18.04 LTS"
Expand Down Expand Up @@ -755,6 +787,7 @@ until [ "$selection" = "0" ]; do
read -r selection
echo ""
case $selection in
0 ) clear ; menu_option_0 ; press_enter ;;
1 ) clear ; menu_option_1 ; press_enter ;;
2 ) clear ; menu_option_2 ; press_enter ;;
3 ) clear ; menu_option_3 ; press_enter ;;
Expand Down
178 changes: 178 additions & 0 deletions builds/linux/debian/11/data/ks.pkrtpl.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Debian 11

# Locale and Keyboard
d-i debian-installer/locale string ${vm_guest_os_language}
d-i keyboard-configuration/xkb-keymap select ${vm_guest_os_keyboard}

# Clock and Timezone
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
d-i time/zone string ${vm_guest_os_timezone}

# Grub and Reboot Message
d-i finish-install/reboot_in_progress note
d-i grub-installer/only_debian boolean true

# Partitioning
d-i partman-auto/method string lvm
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-auto-lvm/new_vg_name string sysvg
d-i partman-efi/non_efi_system boolean true

d-i partman-auto/expert_recipe string \
custom :: \
1024 1024 1024 fat32 \
$primary{ } \
mountpoint{ /boot/efi } \
method{ efi } \
format{ } \
use_filesystem{ } \
filesystem{ vfat } \
label { EFIFS } \
. \
1024 1024 1024 xfs \
$bootable{ } \
$primary{ } \
mountpoint{ /boot } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
label { BOOTFS } \
. \
1024 1024 1024 linux-swap \
$lvmok{ } \
lv_name{ lv_swap } \
in_vg { sysvg } \
method{ swap } \
format{ } \
label { SWAPFS } \
. \
12288 12288 -1 xfs \
$lvmok{ } \
mountpoint{ / } \
lv_name{ lv_root } \
in_vg { sysvg } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
label { ROOTFS } \
. \
4096 4096 4096 xfs \
$lvmok{ } \
mountpoint{ /home } \
lv_name{ lv_home } \
in_vg { sysvg } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
label { HOMEFS } \
options/nodev{ nodev } \
options/nosuid{ nosuid } \
. \
2048 2048 2048 xfs \
$lvmok{ } \
mountpoint{ /opt } \
lv_name{ lv_opt } \
in_vg { sysvg } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
label { OPTFS } \
options/nodev{ nodev } \
. \
3072 3072 3072 xfs \
$lvmok{ } \
mountpoint{ /tmp } \
lv_name{ lv_tmp } \
in_vg { sysvg } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
label { TMPFS } \
options/nodev{ nodev } \
options/noexec{ noexec } \
options/nosuid{ nosuid } \
. \
4096 4096 4096 xfs \
$lvmok{ } \
mountpoint{ /var } \
lv_name{ lv_var } \
in_vg { sysvg } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
label { VARFS } \
options/nodev{ nodev } \
. \
4096 4096 4096 xfs \
$lvmok{ } \
mountpoint{ /var/log } \
lv_name{ lv_log } \
in_vg { sysvg } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
label { LOGFS } \
options/nodev{ nodev } \
options/noexec{ noexec } \
options/nosuid{ nosuid } \
. \
4096 4096 4096 xfs \
$lvmok{ } \
mountpoint{ /var/log/audit } \
lv_name{ lv_audit } \
in_vg { sysvg } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ xfs } \
label { AUDITFS } \
options/nodev{ nodev } \
options/noexec{ noexec } \
options/nosuid{ nosuid } \
. \

d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

# Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain

# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.it.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string

# User Configuration
d-i passwd/root-login boolean false
d-i passwd/user-fullname string ${build_username}
d-i passwd/username string ${build_username}
d-i passwd/user-password-crypted password ${build_password_encrypted}

# Package Configuration
d-i pkgsel/run_tasksel boolean false
d-i pkgsel/include string openssh-server open-vm-tools

# Add User to Sudoers
d-i preseed/late_command string \
echo '${build_username} ALL=(ALL) NOPASSWD: ALL' > /target/etc/sudoers.d/${build_username} ; \
in-target chmod 440 /etc/sudoers.d/${build_username} ;
42 changes: 42 additions & 0 deletions builds/linux/debian/11/linux-debian.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
DESCRIPTION:
Debian 11 variables used by the Packer Plugin for VMware vSphere (vsphere-iso).
*/

// Guest Operating System Metadata
vm_guest_os_language = "en_US"
vm_guest_os_keyboard = "us"
vm_guest_os_timezone = "UTC"
vm_guest_os_family = "linux"
vm_guest_os_name = "debian"
vm_guest_os_version = "11"

// Virtual Machine Guest Operating System Setting
vm_guest_os_type = "debian11_64Guest"

// Virtual Machine Hardware Settings
vm_firmware = "efi-secure"
vm_cdrom_type = "sata"
vm_cpu_sockets = 2
vm_cpu_cores = 1
vm_cpu_hot_add = false
vm_mem_size = 2048
vm_mem_hot_add = false
vm_disk_size = 40960
vm_disk_controller_type = ["pvscsi"]
vm_disk_thin_provisioned = false
vm_network_card = "vmxnet3"

// Removable Media Settings
iso_path = "iso/linux/debian"
iso_file = "debian-11.3.0-amd64-netinst.iso"
iso_checksum_type = "sha256"
iso_checksum_value = "7892981e1da216e79fb3a1536ce5ebab157afdd20048fe458f2ae34fbc26c19b"

// Boot Settings
vm_boot_order = "disk,cdrom"
vm_boot_wait = "5s"

// Communicator Settings
communicator_port = 22
communicator_timeout = "30m"
Loading

0 comments on commit d7aedae

Please sign in to comment.