@underpostnet/underpost 2.96.0 → 2.97.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +1 -2
- package/.env.development +0 -3
- package/.env.production +0 -3
- package/.env.test +0 -3
- package/.prettierignore +1 -2
- package/README.md +31 -31
- package/baremetal/commission-workflows.json +64 -17
- package/baremetal/packer-workflows.json +11 -0
- package/cli.md +72 -40
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +4 -4
- package/package.json +3 -2
- package/packer/images/Rocky9Amd64/rocky9.pkr.hcl +6 -2
- package/packer/images/Rocky9Arm64/Makefile +69 -0
- package/packer/images/Rocky9Arm64/README.md +122 -0
- package/packer/images/Rocky9Arm64/http/rocky9.ks.pkrtpl.hcl +114 -0
- package/packer/images/Rocky9Arm64/rocky9.pkr.hcl +171 -0
- package/scripts/disk-clean.sh +128 -187
- package/scripts/ipxe-setup.sh +197 -0
- package/scripts/packer-init-vars-file.sh +16 -6
- package/scripts/packer-setup.sh +270 -33
- package/scripts/ports-ls.sh +31 -0
- package/scripts/quick-tftp.sh +19 -0
- package/src/api/document/document.controller.js +15 -0
- package/src/api/document/document.model.js +14 -0
- package/src/api/document/document.router.js +1 -0
- package/src/api/document/document.service.js +61 -3
- package/src/cli/baremetal.js +1716 -439
- package/src/cli/cloud-init.js +354 -231
- package/src/cli/cluster.js +1 -1
- package/src/cli/db.js +22 -0
- package/src/cli/deploy.js +6 -2
- package/src/cli/image.js +1 -0
- package/src/cli/index.js +40 -36
- package/src/cli/run.js +77 -11
- package/src/cli/ssh.js +1 -1
- package/src/client/components/core/Input.js +3 -1
- package/src/client/components/core/Panel.js +161 -15
- package/src/client/components/core/PanelForm.js +198 -35
- package/src/client/components/core/Translate.js +11 -0
- package/src/client/services/document/document.service.js +19 -0
- package/src/index.js +2 -1
- package/src/server/dns.js +8 -2
- package/src/server/start.js +14 -6
- package/manifests/mariadb/config.yaml +0 -10
- package/manifests/mariadb/secret.yaml +0 -8
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/make -f
|
|
2
|
+
|
|
3
|
+
include ../../scripts/check.mk
|
|
4
|
+
|
|
5
|
+
PACKER ?= packer
|
|
6
|
+
PACKER_LOG ?= 0
|
|
7
|
+
TIMEOUT ?= 1h
|
|
8
|
+
ARCH ?= arm64
|
|
9
|
+
|
|
10
|
+
# Detect if running on ARM host
|
|
11
|
+
ifeq ($(shell uname -m),aarch64)
|
|
12
|
+
HOST_IS_ARM = true
|
|
13
|
+
else
|
|
14
|
+
HOST_IS_ARM = false
|
|
15
|
+
endif
|
|
16
|
+
|
|
17
|
+
ifeq ($(wildcard /usr/share/OVMF/OVMF_CODE.fd),)
|
|
18
|
+
OVMF_SFX ?= _4M
|
|
19
|
+
else
|
|
20
|
+
OVMF_SFX ?=
|
|
21
|
+
endif
|
|
22
|
+
|
|
23
|
+
export PACKER_LOG
|
|
24
|
+
|
|
25
|
+
# Fallback
|
|
26
|
+
ifeq ($(strip $(ARCH)),amd64)
|
|
27
|
+
ARCH = x86_64
|
|
28
|
+
endif
|
|
29
|
+
ifeq ($(strip $(ARCH)),arm64)
|
|
30
|
+
ARCH = aarch64
|
|
31
|
+
endif
|
|
32
|
+
|
|
33
|
+
.PHONY: all clean
|
|
34
|
+
|
|
35
|
+
all: rocky9.tar.gz
|
|
36
|
+
|
|
37
|
+
$(eval $(call check_packages_deps))
|
|
38
|
+
|
|
39
|
+
lint:
|
|
40
|
+
packer validate .
|
|
41
|
+
packer fmt -check -diff .
|
|
42
|
+
|
|
43
|
+
format:
|
|
44
|
+
packer fmt .
|
|
45
|
+
|
|
46
|
+
OVMF_VARS.fd:
|
|
47
|
+
ifeq ($(strip $(ARCH)),aarch64)
|
|
48
|
+
cp -v /usr/share/AAVMF/AAVMF_VARS.fd ${ARCH}_VARS.fd
|
|
49
|
+
else
|
|
50
|
+
cp -v /usr/share/OVMF/OVMF_VARS${OVMF_SFX}.fd ${ARCH}_VARS.fd
|
|
51
|
+
endif
|
|
52
|
+
|
|
53
|
+
SIZE_VARS.fd:
|
|
54
|
+
ifeq ($(strip $(ARCH)),aarch64)
|
|
55
|
+
truncate -s 64m ${ARCH}_VARS.fd
|
|
56
|
+
else
|
|
57
|
+
truncate -s 2m ${ARCH}_VARS.fd
|
|
58
|
+
endif
|
|
59
|
+
|
|
60
|
+
rocky9.tar.gz: check-deps clean OVMF_VARS.fd SIZE_VARS.fd
|
|
61
|
+
${PACKER} init rocky9.pkr.hcl && ${PACKER} build \
|
|
62
|
+
-var architecture=${ARCH} \
|
|
63
|
+
-var host_is_arm=${HOST_IS_ARM} \
|
|
64
|
+
-var timeout=${TIMEOUT} \
|
|
65
|
+
-var ovmf_suffix=${OVMF_SFX} \
|
|
66
|
+
rocky9.pkr.hcl
|
|
67
|
+
|
|
68
|
+
clean:
|
|
69
|
+
${RM} -rf *.fd output-rocky9 rocky9.tar.gz
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Rocky 9 Packer template for MAAS
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The Packer template in this directory creates a Rocky 9 AMD64/ARM64 image for use with MAAS.
|
|
6
|
+
|
|
7
|
+
## Prerequisites to create the image
|
|
8
|
+
|
|
9
|
+
* A machine running Ubuntu 22.04+ with the ability to run KVM virtual machines.
|
|
10
|
+
* qemu-utils, libnbd-bin, nbdkit and fuse2fs
|
|
11
|
+
* qemu-system
|
|
12
|
+
* qemu-system-modules-spice (If building on Ubuntu 24.04 LTS "Noble")
|
|
13
|
+
* ovmf
|
|
14
|
+
* cloud-image-utils
|
|
15
|
+
* parted
|
|
16
|
+
* [Packer.](https://www.packer.io/intro/getting-started/install.html), v1.11.0 or newer
|
|
17
|
+
|
|
18
|
+
## Requirements to deploy the image
|
|
19
|
+
|
|
20
|
+
* [MAAS](https://maas.io) 3.3 or later, as that version introduces support for Rocky
|
|
21
|
+
* [Curtin](https://launchpad.net/curtin) 22.1. If you have a MAAS with an earlier Curtin version, you can [patch](https://code.launchpad.net/~xnox/curtin/+git/curtin/+merge/415604) distro.py to deploy Rocky.
|
|
22
|
+
|
|
23
|
+
## Customizing the image
|
|
24
|
+
|
|
25
|
+
You can customize the deployment image by modifying http/rocky.ks. See the [RHEL kickstart documentation](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/performing_an_advanced_rhel_installation/kickstart-commands-and-options-reference_installing-rhel-as-an-experienced-user#part-or-partition_kickstart-commands-for-handling-storage) for more information.
|
|
26
|
+
|
|
27
|
+
## Building the image using a proxy
|
|
28
|
+
|
|
29
|
+
The Packer template downloads the Rocky ISO image from the Internet. You can tell Packer to use a proxy by setting the HTTP_PROXY environment variable to point to your proxy server. You can also redefine rocky_iso_url to a local file. If you want to skip the base image integrity check, set iso_checksum_type to none and remove iso_checksum.
|
|
30
|
+
|
|
31
|
+
To use a proxy during the installation define the `KS_PROXY` variable in the environment, as bellow:
|
|
32
|
+
|
|
33
|
+
```shell
|
|
34
|
+
export KS_PROXY="\"${HTTP_PROXY}\""
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
# Building the image using a kickstart mirror
|
|
38
|
+
|
|
39
|
+
To tell Packer to use a specific mirror set the `KS_MIRROR` environment variable
|
|
40
|
+
poiniting to the mirror URL.
|
|
41
|
+
|
|
42
|
+
```shell
|
|
43
|
+
export KS_MIRROR="https://dl.rockylinux.org/pub/rocky/9"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Building an image
|
|
47
|
+
|
|
48
|
+
You can build the image using the Makefile:
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
make
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
You can also manually run packer. Set your current working directory to packer-maas/rocky9, where this file resides, and generate an image with:
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
packer init
|
|
58
|
+
PACKER_LOG=1 packer build .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The installation runs in a non-interactive mode.
|
|
62
|
+
|
|
63
|
+
Note: rocky9.pkr.hcl runs Packer in headless mode, with the serial port output from qemu redirected to stdio to give feedback on image creation process. If you wish to see more, change the value of `headless` to `false` in rocky9.pkr.hcl, remove `[ "-serial", "stdio" ]` from `qemuargs` section and select `View`, then `serial0` in the qemu window that appears during build. This lets you watch progress of the image build script. Press `ctrl-b 2` to switch to shell to explore more, and `ctrl-b 1` to go back to log view.
|
|
64
|
+
|
|
65
|
+
### Makefile Parameters
|
|
66
|
+
|
|
67
|
+
#### ARCH
|
|
68
|
+
|
|
69
|
+
Defaults to x86_64 to build AMD64 compatible images. In order to build ARM64 images, use ARCH=aarch64
|
|
70
|
+
|
|
71
|
+
#### TIMEOUT
|
|
72
|
+
|
|
73
|
+
The timeout to apply when building the image. The default value is set to 1h.
|
|
74
|
+
|
|
75
|
+
## Uploading an image to MAAS
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
maas $PROFILE boot-resources create name='custom/rocky9' \
|
|
79
|
+
title='Rocky 9 Custom' architecture='amd64/generic' \
|
|
80
|
+
base_image='rhel/9' filetype='tgz' \
|
|
81
|
+
content@=rocky9.tar.gz
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For ARM64, use:
|
|
85
|
+
|
|
86
|
+
```shell
|
|
87
|
+
maas $PROFILE boot-resources create name='custom/rocky9' \
|
|
88
|
+
title='Rocky 9 Custom' architecture='arm64/generic' \
|
|
89
|
+
base_image='rhel/9' filetype='tgz' \
|
|
90
|
+
content@=rocky9.tar.gz
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Please note that, currently due to lack of support in curtin, deploying ARM64 images needs a preseed file. This is due to [LP# 2090874](https://bugs.launchpad.net/curtin/+bug/2090874) and currently is in the process of getting fixed.
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
#cloud-config
|
|
97
|
+
debconf_selections:
|
|
98
|
+
maas: |
|
|
99
|
+
{{for line in str(curtin_preseed).splitlines()}}
|
|
100
|
+
{{line}}
|
|
101
|
+
{{endfor}}
|
|
102
|
+
|
|
103
|
+
extract_commands:
|
|
104
|
+
grub_install: curtin in-target -- cp -v /boot/efi/EFI/rocky/shimaa64.efi /boot/efi/EFI/rocky/shimx64.efi
|
|
105
|
+
|
|
106
|
+
late_commands:
|
|
107
|
+
maas: [wget, '--no-proxy', '{{node_disable_pxe_url}}', '--post-data', '{{node_disable_pxe_data}}', '-O', '/dev/null']
|
|
108
|
+
bootloader_01: ["curtin", "in-target", "--", "cp", "-v", "/boot/efi/EFI/rocky/shimaa64.efi", "/boot/efi/EFI/BOOT/bootaa64.efi"]
|
|
109
|
+
bootloader_02: ["curtin", "in-target", "--", "cp", "-v", "/boot/efi/EFI/rocky/grubaa64.efi", "/boot/efi/EFI/BOOT/"]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This file needs to be saved on Region Controllers under /var/snap/maas/current/preseeds/curtin_userdata_custom_arm64_generic_rocky9 or /etc/maas/preseeds/curtin_userdata_custom_arm64_generic_rocky9. The last portion of this file must match the image name uploaded in MAAS.
|
|
113
|
+
|
|
114
|
+
## Default username
|
|
115
|
+
|
|
116
|
+
MAAS uses cloud-init to create ```cloud-user``` account using the ssh keys configured for the MAAS admin user (e.g. imported from Launchpad). Log in to the machine:
|
|
117
|
+
|
|
118
|
+
```shell
|
|
119
|
+
ssh -i ~/.ssh/<your_identity_file> cloud-user@<machine-ip-address>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Next to that, the kickstart script creates an account with both username and password set to ```rocky```. Note that the default sshd configuration in Rocky 9 disallows password-based authentication when logging in via ssh, so trying `ssh rocky@<machine-ip-address>` will fail. Password-based authentication can be enabled by having `PasswordAuthentication yes` in /etc/ssh/sshd_config after logging in with ```cloud-user```. Perhaps there is a way to make that change using kickstart script, but it is not obvious as ```anaconda```, the installer, makes its own changes to sshd_config file during installation. If you know how to do this, a PR is welcome.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
url ${KS_OS_REPOS} ${KS_PROXY}
|
|
2
|
+
repo --name="AppStream" ${KS_APPSTREAM_REPOS} ${KS_PROXY}
|
|
3
|
+
repo --name="Extras" ${KS_EXTRAS_REPOS} ${KS_PROXY}
|
|
4
|
+
|
|
5
|
+
eula --agreed
|
|
6
|
+
|
|
7
|
+
# Turn off after installation
|
|
8
|
+
poweroff
|
|
9
|
+
|
|
10
|
+
# Do not start the Inital Setup app
|
|
11
|
+
firstboot --disable
|
|
12
|
+
|
|
13
|
+
# System language, keyboard and timezone
|
|
14
|
+
lang en_US.UTF-8
|
|
15
|
+
keyboard us
|
|
16
|
+
timezone UTC --utc
|
|
17
|
+
|
|
18
|
+
# Set the first NIC to acquire IPv4 address via DHCP
|
|
19
|
+
network --device eth0 --bootproto=dhcp
|
|
20
|
+
# Enable firewal, let SSH through
|
|
21
|
+
firewall --enabled --service=ssh
|
|
22
|
+
# Enable SELinux with default enforcing policy
|
|
23
|
+
selinux --enforcing
|
|
24
|
+
|
|
25
|
+
# Do not set up XX Window System
|
|
26
|
+
skipx
|
|
27
|
+
|
|
28
|
+
# Initial disk setup
|
|
29
|
+
# Use the first paravirtualized disk
|
|
30
|
+
ignoredisk --only-use=vda
|
|
31
|
+
# No need for bootloader
|
|
32
|
+
bootloader --disabled
|
|
33
|
+
# Wipe invalid partition tables
|
|
34
|
+
zerombr
|
|
35
|
+
# Erase all partitions and assign default labels
|
|
36
|
+
clearpart --all --initlabel
|
|
37
|
+
# Initialize the primary root partition with ext4 filesystem
|
|
38
|
+
part / --size=1 --grow --asprimary --fstype=ext4
|
|
39
|
+
|
|
40
|
+
# Set root password
|
|
41
|
+
rootpw --plaintext password
|
|
42
|
+
|
|
43
|
+
# Add a user named packer
|
|
44
|
+
user --groups=wheel --name=rocky --password=rocky --plaintext --gecos="rocky"
|
|
45
|
+
|
|
46
|
+
%post --erroronfail
|
|
47
|
+
# workaround anaconda requirements and clear root password
|
|
48
|
+
passwd -d root
|
|
49
|
+
passwd -l root
|
|
50
|
+
|
|
51
|
+
# Clean up install config not applicable to deployed environments.
|
|
52
|
+
for f in resolv.conf fstab; do
|
|
53
|
+
rm -f /etc/$f
|
|
54
|
+
touch /etc/$f
|
|
55
|
+
chown root:root /etc/$f
|
|
56
|
+
chmod 644 /etc/$f
|
|
57
|
+
done
|
|
58
|
+
|
|
59
|
+
rm -f /etc/sysconfig/network-scripts/ifcfg-[^lo]*
|
|
60
|
+
|
|
61
|
+
# Kickstart copies install boot options. Serial is turned on for logging with
|
|
62
|
+
# Packer which disables console output. Disable it so console output is shown
|
|
63
|
+
# during deployments
|
|
64
|
+
sed -i 's/^GRUB_TERMINAL=.*/GRUB_TERMINAL_OUTPUT="console"/g' /etc/default/grub
|
|
65
|
+
sed -i '/GRUB_SERIAL_COMMAND="serial"/d' /etc/default/grub
|
|
66
|
+
sed -ri 's/(GRUB_CMDLINE_LINUX=".*)\s+console=ttyAMA0(.*")/\1\2/' /etc/default/grub
|
|
67
|
+
sed -i 's/GRUB_ENABLE_BLSCFG=.*/GRUB_ENABLE_BLSCFG=false/g' /etc/default/grub
|
|
68
|
+
|
|
69
|
+
dnf clean all
|
|
70
|
+
|
|
71
|
+
# Passwordless sudo for the user 'rocky'
|
|
72
|
+
echo "rocky ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/rocky
|
|
73
|
+
chmod 440 /etc/sudoers.d/rocky
|
|
74
|
+
|
|
75
|
+
#---- Optional - Install your SSH key ----
|
|
76
|
+
# mkdir -m0700 /home/rocky/.ssh/
|
|
77
|
+
#
|
|
78
|
+
# cat <<EOF >/home/rocky/.ssh/authorized_keys
|
|
79
|
+
# ssh-rsa <your_public_key_here> you@your.domain
|
|
80
|
+
# EOF
|
|
81
|
+
#
|
|
82
|
+
### set permissions
|
|
83
|
+
# chmod 0600 /home/rocky/.ssh/authorized_keys
|
|
84
|
+
#
|
|
85
|
+
#### fix up selinux context
|
|
86
|
+
# restorecon -R /home/rocky/.ssh/
|
|
87
|
+
|
|
88
|
+
%end
|
|
89
|
+
|
|
90
|
+
%packages --ignoremissing
|
|
91
|
+
@core
|
|
92
|
+
bash-completion
|
|
93
|
+
cloud-init
|
|
94
|
+
cloud-utils-growpart
|
|
95
|
+
rsync
|
|
96
|
+
tar
|
|
97
|
+
patch
|
|
98
|
+
yum-utils
|
|
99
|
+
grub2-pc
|
|
100
|
+
grub2-efi-*
|
|
101
|
+
shim-*
|
|
102
|
+
grub2-efi-*-modules
|
|
103
|
+
efibootmgr
|
|
104
|
+
dosfstools
|
|
105
|
+
lvm2
|
|
106
|
+
mdadm
|
|
107
|
+
device-mapper-multipath
|
|
108
|
+
iscsi-initiator-utils
|
|
109
|
+
-plymouth
|
|
110
|
+
# Remove ALSA firmware
|
|
111
|
+
-a*-firmware
|
|
112
|
+
# Remove Intel wireless firmware
|
|
113
|
+
-i*-firmware
|
|
114
|
+
%end
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
packer {
|
|
2
|
+
required_version = ">= 1.11.0"
|
|
3
|
+
required_plugins {
|
|
4
|
+
qemu = {
|
|
5
|
+
version = ">= 1.1.0, < 1.1.2"
|
|
6
|
+
source = "github.com/hashicorp/qemu"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
variable "filename" {
|
|
12
|
+
type = string
|
|
13
|
+
default = "rocky9.tar.gz"
|
|
14
|
+
description = "The filename of the tarball to produce"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
variable ks_proxy {
|
|
18
|
+
type = string
|
|
19
|
+
default = "${env("KS_PROXY")}"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
variable ks_mirror {
|
|
23
|
+
type = string
|
|
24
|
+
default = "${env("KS_MIRROR")}"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
variable "timeout" {
|
|
28
|
+
type = string
|
|
29
|
+
default = "1h"
|
|
30
|
+
description = "Timeout for building the image"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
variable "architecture" {
|
|
34
|
+
type = string
|
|
35
|
+
default = "arm64"
|
|
36
|
+
description = "The architecture to build the image for (amd64 or arm64)"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
variable "host_is_arm" {
|
|
40
|
+
type = bool
|
|
41
|
+
default = false
|
|
42
|
+
description = "The host architecture is aarch64"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
variable "ovmf_suffix" {
|
|
46
|
+
type = string
|
|
47
|
+
default = ""
|
|
48
|
+
description = "Suffix for OVMF CODE and VARS files. Newer systems such as Noble use _4M."
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
variable "headless" {
|
|
52
|
+
type = bool
|
|
53
|
+
default = true
|
|
54
|
+
description = "Run packer in headless mode"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
locals {
|
|
58
|
+
iso_arch_map = {
|
|
59
|
+
"amd64" = "x86_64"
|
|
60
|
+
"x86_64" = "x86_64"
|
|
61
|
+
"arm64" = "aarch64"
|
|
62
|
+
"aarch64" = "aarch64"
|
|
63
|
+
}
|
|
64
|
+
iso_arch = lookup(local.iso_arch_map, var.architecture, "aarch64")
|
|
65
|
+
|
|
66
|
+
iso_checksum_map = {
|
|
67
|
+
"amd64" = "sha256:3b5c87b2f9e62fdf0235d424d64c677906096965aad8a580e0e98fcb9f97f267"
|
|
68
|
+
"x86_64" = "sha256:3b5c87b2f9e62fdf0235d424d64c677906096965aad8a580e0e98fcb9f97f267"
|
|
69
|
+
"arm64" = "sha256:a9ba9ff1187300cecccfaea021eeac04b6408b1180071fb22ee73249f075485e"
|
|
70
|
+
"aarch64" = "sha256:a9ba9ff1187300cecccfaea021eeac04b6408b1180071fb22ee73249f075485e"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
qemu_arch = {
|
|
74
|
+
"amd64" = "x86_64"
|
|
75
|
+
"x86_64" = "x86_64"
|
|
76
|
+
"arm64" = "aarch64"
|
|
77
|
+
"aarch64" = "aarch64"
|
|
78
|
+
}
|
|
79
|
+
uefi_imp = {
|
|
80
|
+
"amd64" = "OVMF"
|
|
81
|
+
"x86_64" = "OVMF"
|
|
82
|
+
"arm64" = "AAVMF"
|
|
83
|
+
"aarch64" = "AAVMF"
|
|
84
|
+
}
|
|
85
|
+
uefi_sfx = {
|
|
86
|
+
"amd64" = "${var.ovmf_suffix}"
|
|
87
|
+
"x86_64" = "${var.ovmf_suffix}"
|
|
88
|
+
"arm64" = ""
|
|
89
|
+
"aarch64" = ""
|
|
90
|
+
}
|
|
91
|
+
qemu_machine = {
|
|
92
|
+
"amd64" = "accel=kvm"
|
|
93
|
+
"x86_64" = "accel=kvm"
|
|
94
|
+
"arm64" = var.host_is_arm ? "virt,accel=kvm" : "virt"
|
|
95
|
+
"aarch64" = var.host_is_arm ? "virt,accel=kvm" : "virt"
|
|
96
|
+
}
|
|
97
|
+
qemu_cpu = {
|
|
98
|
+
"amd64" = "host"
|
|
99
|
+
"x86_64" = "host"
|
|
100
|
+
"arm64" = var.host_is_arm ? "host" : "max"
|
|
101
|
+
"aarch64" = var.host_is_arm ? "host" : "max"
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
ks_proxy = var.ks_proxy != "" ? "--proxy=${var.ks_proxy}" : ""
|
|
105
|
+
ks_os_repos = var.ks_mirror != "" ? "--url=${var.ks_mirror}/BaseOS/${local.iso_arch}/os" : "--mirrorlist='http://mirrors.rockylinux.org/mirrorlist?arch=${local.iso_arch}&repo=BaseOS-9'"
|
|
106
|
+
ks_appstream_repos = var.ks_mirror != "" ? "--baseurl=${var.ks_mirror}/AppStream/${local.iso_arch}/os" : "--mirrorlist='https://mirrors.rockylinux.org/mirrorlist?release=9&arch=${local.iso_arch}&repo=AppStream-9'"
|
|
107
|
+
ks_extras_repos = var.ks_mirror != "" ? "--baseurl=${var.ks_mirror}/extras/${local.iso_arch}/os" : "--mirrorlist='https://mirrors.rockylinux.org/mirrorlist?arch=${local.iso_arch}&repo=extras-9'"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
source "qemu" "rocky9" {
|
|
111
|
+
boot_command = ["<up><wait>", "e", "<down><down><down><left>", " console=ttyAMA0 inst.cmdline inst.text inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/rocky9.ks <f10>"]
|
|
112
|
+
boot_wait = "5s"
|
|
113
|
+
communicator = "none"
|
|
114
|
+
disk_size = "45G"
|
|
115
|
+
format = "qcow2"
|
|
116
|
+
headless = var.headless
|
|
117
|
+
iso_checksum = lookup(local.iso_checksum_map, var.architecture, "file:https://download.rockylinux.org/pub/rocky/9/isos/${local.iso_arch}/CHECKSUM")
|
|
118
|
+
iso_urls = [
|
|
119
|
+
"https://download.rockylinux.org/pub/rocky/9/isos/${local.iso_arch}/Rocky-9-latest-${local.iso_arch}-boot.iso",
|
|
120
|
+
"https://dl.rockylinux.org/pub/rocky/9/isos/${local.iso_arch}/Rocky-9-latest-${local.iso_arch}-boot.iso",
|
|
121
|
+
"https://mirrors.edge.kernel.org/rocky/9/isos/${local.iso_arch}/Rocky-9-latest-${local.iso_arch}-boot.iso"
|
|
122
|
+
]
|
|
123
|
+
iso_target_path = "packer_cache/Rocky-9-latest-${local.iso_arch}-boot.iso"
|
|
124
|
+
memory = 2048
|
|
125
|
+
cores = 4
|
|
126
|
+
qemu_binary = "qemu-system-${lookup(local.qemu_arch, var.architecture, "")}"
|
|
127
|
+
qemuargs = [
|
|
128
|
+
["-serial", "stdio"],
|
|
129
|
+
["-boot", "strict=off"],
|
|
130
|
+
["-device", "qemu-xhci"],
|
|
131
|
+
["-device", "usb-kbd"],
|
|
132
|
+
["-device", "virtio-net-pci,netdev=net0"],
|
|
133
|
+
["-netdev", "user,id=net0"],
|
|
134
|
+
["-device", "virtio-blk-pci,drive=drive0,bootindex=0"],
|
|
135
|
+
["-device", "virtio-blk-pci,drive=cdrom0,bootindex=1"],
|
|
136
|
+
["-machine", "${lookup(local.qemu_machine, var.architecture, "")}"],
|
|
137
|
+
["-cpu", "${lookup(local.qemu_cpu, var.architecture, "")}"],
|
|
138
|
+
["-device", "virtio-gpu-pci"],
|
|
139
|
+
["-global", "driver=cfi.pflash01,property=secure,value=off"],
|
|
140
|
+
["-drive", "if=pflash,format=raw,unit=0,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE${lookup(local.uefi_sfx, var.architecture, "")}.fd"],
|
|
141
|
+
["-drive", "if=pflash,format=raw,unit=1,id=ovmf_vars,file=${local.iso_arch}_VARS.fd"],
|
|
142
|
+
["-drive", "file=output-rocky9/packer-rocky9,if=none,id=drive0,cache=writeback,discard=ignore,format=qcow2"],
|
|
143
|
+
["-drive", "file=packer_cache/Rocky-9-latest-${local.iso_arch}-boot.iso,if=none,id=cdrom0,media=cdrom"]
|
|
144
|
+
]
|
|
145
|
+
shutdown_timeout = var.timeout
|
|
146
|
+
http_content = {
|
|
147
|
+
"/rocky9.ks" = templatefile("${path.root}/http/rocky9.ks.pkrtpl.hcl",
|
|
148
|
+
{
|
|
149
|
+
KS_PROXY = local.ks_proxy,
|
|
150
|
+
KS_OS_REPOS = local.ks_os_repos,
|
|
151
|
+
KS_APPSTREAM_REPOS = local.ks_appstream_repos,
|
|
152
|
+
KS_EXTRAS_REPOS = local.ks_extras_repos
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
build {
|
|
159
|
+
sources = ["source.qemu.rocky9"]
|
|
160
|
+
|
|
161
|
+
post-processor "shell-local" {
|
|
162
|
+
inline = [
|
|
163
|
+
"SOURCE=${source.name}",
|
|
164
|
+
"OUTPUT=${var.filename}",
|
|
165
|
+
"source ../../scripts/fuse-nbd",
|
|
166
|
+
"source ../../scripts/fuse-tar-root",
|
|
167
|
+
"rm -rf output-${source.name}",
|
|
168
|
+
]
|
|
169
|
+
inline_shebang = "/bin/bash -e"
|
|
170
|
+
}
|
|
171
|
+
}
|