Switches to netinstall images instead of minimal

Other changes:

  - Adjusted packer configs to use MSVSphere 9 as a base platform
    for building images.
  - Added special notes on building images on Fedora.
  - Added instructions on debugging image build process.
  - Added vnc_port_min and vnc_port_max packer variables to make
    build on remote machines easier.
  - Updated Generic Cloud kickstart file to use public mirror
    instead of the internal one.
  - Updated Generic Cloud kickstart file to use "os" instead of
    "kickstart" repos in order to install all present updates.
netinst-debug-docs
Eugene Zamriy 11 months ago
parent 207e05406b
commit 2c676ad07c
Signed by: ezamriy
GPG Key ID: 7EBF95C7DCFA496C

@ -11,7 +11,13 @@ Supported operating systems:
* MSVSphere 9 and other EL9-compatible distributions * MSVSphere 9 and other EL9-compatible distributions
* Fedora * Fedora
Follow the Packer installation [instructions](https://developer.hashicorp.com/packer/downloads?product_intent=packer). First install Ansible, which we use for virtual machines provisioning:
```shell
$ dnf install ansible-core
```
Then follow the Packer installation [instructions](https://developer.hashicorp.com/packer/downloads?product_intent=packer).
Alternatively, you can install a Packer binary from a Yandex Alternatively, you can install a Packer binary from a Yandex
[mirror](https://hashicorp-releases.yandexcloud.net/packer/): just download a [mirror](https://hashicorp-releases.yandexcloud.net/packer/): just download a
@ -21,7 +27,7 @@ Verify that Packer works:
```shell ```shell
$ packer version $ packer version
Packer v1.9.1 1.9.4
``` ```
In order to install required Packer plugins run the following command in the In order to install required Packer plugins run the following command in the
@ -43,11 +49,15 @@ You will also need to install either QEMU/KVM or VirtualBox or
VMWare Workstation, depending on what types of images you are going to build. VMWare Workstation, depending on what types of images you are going to build.
For VirtualBox and VMWare Workstation just follow the official site For VirtualBox and VMWare Workstation just follow the official site
instructions. documentation.
The QEMU/KVM installation instructions are provided below: The QEMU/KVM installation instructions are provided below:
```shell ```shell
# for MSVSphere 9
$ dnf install edk2-ovmf libvirt libvirt-daemon-kvm
# for Fedora
$ dnf install @virtualization $ dnf install @virtualization
$ dnf install edk2-ovmf $ dnf install edk2-ovmf
``` ```
@ -65,6 +75,16 @@ where `${BUILDER}` is a Packer builder (e.g. `virtualbox-iso`) and
`${CONFIGURATION}` is an image configuration name (e.g. `${CONFIGURATION}` is an image configuration name (e.g.
`msvsphere-9-vagrant-x86_64`). `msvsphere-9-vagrant-x86_64`).
On Fedora you might need to provide extra options because it has different
paths for qemu-kvm and edk2 firmware:
```shell
$ packer build -var qemu_binary=/usr/bin/qemu-kvm \
-var uefi_ovmf_code=/usr/share/OVMF/OVMF_CODE.fd \
-var uefi_ovmf_vars=/usr/share/OVMF/OVMF_VARS.fd \
-only=${BUILDER}.${CONFIGURATION} .
```
A graphical VM console is disabled by default, but you can enable it for A graphical VM console is disabled by default, but you can enable it for
debugging purposes by setting the `headless` variable to `false`: debugging purposes by setting the `headless` variable to `false`:
@ -100,6 +120,44 @@ VMWare Vagrant box build command:
$ packer build -only=vmware-iso.msvsphere-9-vagrant-x86_64 . $ packer build -only=vmware-iso.msvsphere-9-vagrant-x86_64 .
``` ```
## Debugging image builds
Use `PACKER_LOG=1` environment variable definition to get extra debug output
from Packer:
```shell
$ PACKER_LOG=1 packer build ...
```
other Packer debugging techniques are described in the Packer
[documentation](https://developer.hashicorp.com/packer/docs/debugging).
Add `-vvvv` flag to the Ansible's `extra_arguments` block in a Packer config
in order to get verbose output from Ansible:
```hcl
build {
provisioner "ansible" {
...
extra_arguments = [..., "-vvvv"]
}
}
```
Additionally, you can connect to Packer's VNC session using a VNC client.
For TigerVNC you will need to enable the following settings:
* Input -> View only (ignore mouse and keyboard)
* Misc -> Shared (don't disconnect other viewers)
By default Packer is running a VNC server on a random TCP port in the
5900:6000 range. But for remote build environments it might be useful
to use a specific port so that you can configure a firewall easily:
```shell
$ packer build ... -var vnc_bind_address=0.0.0.0 -var vnc_port_min=5900 \
-var vnc_port_max=5900 .
```
## License ## License

@ -1,9 +1,8 @@
# MSVSphere 9 Generic Cloud image kickstart file # MSVSphere 9 Generic Cloud image kickstart file
# TODO: change url to the kickstart one when we have it url --url https://repo1.msvsphere-os.ru/msvsphere/9.3/BaseOS/x86_64/kickstart/
url --url https://rsync.inferitos.ru/msvsphere/9.3/BaseOS/x86_64/kickstart/ repo --name=BaseOS --baseurl=https://repo1.msvsphere-os.ru/msvsphere/9.3/BaseOS/x86_64/os/
repo --name=BaseOS --baseurl=https://rsync.inferitos.ru/msvsphere/9.3/BaseOS/x86_64/kickstart/ repo --name=AppStream --baseurl=https://repo1.msvsphere-os.ru/msvsphere/9.3/AppStream/x86_64/os/
repo --name=AppStream --baseurl=https://rsync.inferitos.ru/msvsphere/9.3/AppStream/x86_64/kickstart/
text text
skipx skipx

@ -17,6 +17,8 @@ source "qemu" "msvsphere-9-gencloud-x86_64" {
ssh_password = var.gencloud_ssh_password ssh_password = var.gencloud_ssh_password
ssh_timeout = var.ssh_timeout ssh_timeout = var.ssh_timeout
vnc_bind_address = var.vnc_bind_address vnc_bind_address = var.vnc_bind_address
vnc_port_min = var.vnc_port_min
vnc_port_max = var.vnc_port_max
accelerator = "kvm" accelerator = "kvm"
efi_firmware_code = var.uefi_ovmf_code efi_firmware_code = var.uefi_ovmf_code
efi_firmware_vars = var.uefi_ovmf_vars efi_firmware_vars = var.uefi_ovmf_vars

@ -17,6 +17,8 @@ source "qemu" "msvsphere-9-yandexcloud-x86_64" {
ssh_password = var.gencloud_ssh_password ssh_password = var.gencloud_ssh_password
ssh_timeout = var.ssh_timeout ssh_timeout = var.ssh_timeout
vnc_bind_address = var.vnc_bind_address vnc_bind_address = var.vnc_bind_address
vnc_port_min = var.vnc_port_min
vnc_port_max = var.vnc_port_max
accelerator = "kvm" accelerator = "kvm"
efi_firmware_code = var.uefi_ovmf_code efi_firmware_code = var.uefi_ovmf_code
efi_firmware_vars = var.uefi_ovmf_vars efi_firmware_vars = var.uefi_ovmf_vars

@ -12,13 +12,13 @@ variable "os_version_9" {
variable "iso_url_9_x86_64" { variable "iso_url_9_x86_64" {
description = "MSVSphere 9 x86_64 installation ISO URL" description = "MSVSphere 9 x86_64 installation ISO URL"
type = string type = string
default = "https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-minimal.iso" default = "https://repo1.msvsphere-os.ru/msvsphere/9/isos/x86_64/MSVSphere-9.3-x86_64-netinstall.iso"
} }
variable "iso_checksum_9_x86_64" { variable "iso_checksum_9_x86_64" {
description = "MSVSphere 9 x86_64 installation ISO checksum" description = "MSVSphere 9 x86_64 installation ISO checksum"
type = string type = string
default = "file:https://rsync.inferitos.ru/msvsphere/9.3/isos/x86_64/MSVSphere-9.3-x86_64-minimal.iso.CHECKSUM" default = "file:https://repo1.msvsphere-os.ru/msvsphere/9/isos/x86_64/MSVSphere-9.3-x86_64-netinstall.iso.CHECKSUM"
} }
variable "headless" { variable "headless" {
@ -78,19 +78,22 @@ variable "http_directory" {
variable "uefi_ovmf_code" { variable "uefi_ovmf_code" {
description = "QEMU/KVM UEFI firmware path" description = "QEMU/KVM UEFI firmware path"
type = string type = string
default = "/usr/share/OVMF/OVMF_CODE.fd" // on Fedora use "/usr/share/OVMF/OVMF_CODE.fd"
default = "/usr/share/edk2/ovmf/OVMF_CODE.fd"
} }
variable "uefi_ovmf_vars" { variable "uefi_ovmf_vars" {
description = "QEMU/KVM UEFI firmware variables path" description = "QEMU/KVM UEFI firmware variables path"
type = string type = string
default = "/usr/share/OVMF/OVMF_VARS.fd" // on Fedora use "/usr/share/OVMF/OVMF_VARS.fd"
default = "/usr/share/edk2/ovmf/OVMF_VARS.fd"
} }
variable "qemu_binary" { variable "qemu_binary" {
description = "QEMU binary path" description = "QEMU binary path"
type = string type = string
default = null // on Fedora use "/usr/bin/qemu-kvm"
default = "/usr/libexec/qemu-kvm"
} }
/** /**
@ -136,6 +139,18 @@ variable "vnc_bind_address" {
default = "127.0.0.1" default = "127.0.0.1"
} }
variable "vnc_port_min" {
description = "The minimum port to use for Packer VNC server"
type = number
default = 5900
}
variable "vnc_port_max" {
description = "The maxium port to use for Packer VNC server"
type = number
default = 6000
}
/** /**
* Generic Cloud-specific settings. * Generic Cloud-specific settings.
*/ */
@ -152,7 +167,7 @@ variable "gencloud_boot_cmd_9_x86_64_uefi" {
"c<wait>", "c<wait>",
"linuxefi", "linuxefi",
" /images/pxeboot/vmlinuz", " /images/pxeboot/vmlinuz",
" inst.stage2=hd:LABEL=MSVSphere-9-3-Minimal-x86_64 ro", " inst.stage2=hd:LABEL=MSVSphere-9-3-BaseOS-x86_64 ro",
" inst.text biosdevname=0 net.ifnames=0", " inst.text biosdevname=0 net.ifnames=0",
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/msvsphere-9-gencloud.x86_64.ks", " inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/msvsphere-9-gencloud.x86_64.ks",
"<enter>", "<enter>",

Loading…
Cancel
Save