Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve ESXi build #139

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vmware-esxi/KS.CFG
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ vmaccepteula
# If changed be sure to update the vcenter script below.
rootpw password123!

install --firstdisk
install --firstdisk --ignoreprereqwarnings --ignoreprereqerrors --forceunsupportedinstall

# Sets VMware ESXi licensing key. If not included installs in
# evaluation mode.
Expand Down
2 changes: 1 addition & 1 deletion vmware-esxi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ format: $(VENV)
clean:
${SUDO} ${RM} -rf output-esxi vmware-esxi.dd vmware-esxi.dd.gz $(VENV)

.INTERMEDIATE: scripts.tar.xz
.INTERMEDIATE: scripts.tar.xz
41 changes: 29 additions & 12 deletions vmware-esxi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,36 @@

## Introduction

[MAAS](https://maas.io) 2.5 and above has the ability to deploy VMware ESXi as a custom image. [MAAS](https://maas.io) cannot directly deploy the VMware ESXi ISO, a specialized image must be created from the ISO. Canonical has created a Packer template to automatically do this for you.

## Prerequisites (to create the images)

* A machine running Ubuntu 18.04+ with the ability to run KVM virtual machines.
* Dual core x86_64 processor supporting hardware virtualization with at least 4GB of RAM and 32GB of disk space available.
* qemu-kvm
* qemu-utils, libnbd-bin, nbdkit and fusefat
* Python Pip
* [Packer](https://www.packer.io/intro/getting-started/install.html), v1.7.0 or newer
[MAAS](https://maas.io) has the ability to deploy VMware ESXi as a custom image. MAAS cannot directly deploy the VMware ESXi ISO, a specialized image must be created from the ISO. Canonical has created a Packer template to automatically do this for you.

## Hardware Prerequisites (to create the images)

* A machine running Ubuntu 18.04 or 20.04 with the ability to run KVM virtual machines.
* Dual core x86_64 processor supporting hardware virtualization with at least 8GB of RAM and 32GB of disk space available.

## Package Prerequisites (to create the images)

* build-essential
* fuse2fs
* fusefat
* libnbd0
* libosinfo-bin
* libvirt-daemon
* libvirt-daemon-system
* nbdfuse
* nbdkit
* ovmf
* python3-dev
* python3-pip
* qemu-block-extra
* qemu-system-x86
* qemu-utils
* Packer - from upstream repository, v1.9.0 or newer
* The VMware ESXi installation ISO must be downloaded manually. You can download it [here.](https://www.vmware.com/go/get-free-esxi)

## Requirements (to deploy the image)

* [MAAS](https://maas.io) 2.5 or above, [MAAS](https://maas.io) 2.6 required for storage configuration
* [MAAS](https://maas.io) 3.0 or above
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the previous section said 3.3 and above?


VMware ESXi has a specific set of [hardware requirements](https://www.vmware.com/resources/compatibility/search.php) which are more stringent than MAAS.

Expand All @@ -35,7 +50,7 @@ make ISO=/path/to/VMware-VMvisor-Installer-8.0b-21203435.x86_64.iso
Alternatively you can manually run packer. Your current working directory must be in packer-maas/vmware-esxi, where this file is located. Once in packer-maas/vmware-esxi you can generate an image with:

```shell
sudo packer init
sudo packer init .
sudo PACKER_LOG=1 packer build -var 'vmware_esxi_iso_path=/path/to/VMware-VMvisor-Installer-8.0b-21203435.x86_64.iso' .
```

Expand All @@ -45,6 +60,8 @@ Installation is non-interactive.

## Uploading an image to MAAS

_Note: If using snap-based MAAS, the image to be uploaded needs reside under your home directory._

```shell
maas $PROFILE boot-resources create \
name='esxi/8.0b' title='VMware ESXi 8.0b' \
Expand Down
13 changes: 7 additions & 6 deletions vmware-esxi/post.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/sh
#!/bin/sh -x
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as with the other review: why do we need this?


echo 'Adding curtin-hooks to image...'
mount_part 1 $TMP_DIR/boot fusefat
cp -rv curtin $TMP_DIR/boot/
mount_part 1 "$TMP_DIR"/boot fusefat
cp -rv curtin "$TMP_DIR"/boot/

echo 'Adding post-install scripts to image...'
cp -v scripts.tar.xz $TMP_DIR/boot/curtin/
cp -v scripts.tar.xz "$TMP_DIR"/boot/curtin/

echo 'Unmounting image...'
sync -f $TMP_DIR/boot
fusermount -u $TMP_DIR/boot
sync -f "$TMP_DIR"/boot
fusermount -z -u "$TMP_DIR"/boot
grep -qs "$TMP_DIR/boot " /proc/mounts && umount -f "$TMP_DIR"/boot