-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4d4c1e
commit dad081b
Showing
9 changed files
with
442 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/make -f | ||
|
||
include ../scripts/check.mk | ||
|
||
PACKER ?= packer | ||
PACKER_LOG ?= 0 | ||
|
||
export PACKER_LOG KS_PROXY | ||
|
||
.PHONY: all clean | ||
|
||
all: ol8.tar.gz | ||
|
||
check-deps: | ||
$(call check_packages_deps) | ||
|
||
ol8.tar.gz: check-deps clean http/ol8.ks | ||
${PACKER} init ol8.pkr.hcl && ${PACKER} build ol8.pkr.hcl | ||
|
||
http/ol8.ks: http/ol8.ks.in | ||
envsubst '$${KS_PROXY}' < $< | tee $@ | ||
|
||
clean: | ||
${RM} -rf output-ol8 ol8.tar.gz http/ol8.ks | ||
|
||
.INTERMEDIATE: http/ol8.ks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# OL 8 Packer Template for MAAS | ||
|
||
## Introduction | ||
|
||
The Packer template in this directory creates an OL 8 AMD64 image for use with MAAS. | ||
|
||
## Prerequisites (to create the image) | ||
|
||
* A machine running Ubuntu 22.04+ with the ability to run KVM virtual machines. | ||
* qemu-utils, libnbd-bin, nbdkit and fuse2fs | ||
* [Packer](https://www.packer.io/intro/getting-started/install.html), v1.8.0 or newer | ||
|
||
## Requirements (to deploy the image) | ||
|
||
* [MAAS](https://maas.io) ___stamatis_version_replace_me___ | ||
* [Curtin](https://launchpad.net/curtin) ___stamatis_version_replace_me___ | ||
|
||
## Customizing the Image | ||
|
||
The deployment image may be customized by modifying http/ol8.ks. See the [OL8 kickstart documentation](https://docs.oracle.com/en/operating-systems/oracle-linux/8/install/install-AutomatinganOracleLinuxInstallationbyUsingKickstart.html) for more information. | ||
|
||
## Building the image using a proxy | ||
|
||
The Packer template downloads the OL net installer from the Internet. To | ||
tell Packer to use a proxy set the HTTP_PROXY environment variable to your proxy | ||
server. Alternatively you may redefine iso_url to a local file, set | ||
iso_checksum_type to none to disable checksuming, and remove iso_checksum_url. | ||
|
||
To use a proxy during the installation define the `KS_PROXY` variable in the | ||
environment, as bellow: | ||
|
||
```shell | ||
export KS_PROXY="--proxy=\"${HTTP_PROXY}\"" | ||
``` | ||
|
||
## Building an image | ||
|
||
You can easily build the image using the Makefile: | ||
|
||
```shell | ||
make | ||
``` | ||
|
||
Alternatively you can manually run packer. Your current working directory must | ||
be in packer-maas/ol8, where this file is located. Once in packer-maas/ol8 | ||
you can generate an image with: | ||
|
||
```shell | ||
packer init | ||
PACKER_LOG=1 packer build . | ||
``` | ||
|
||
Note: ol8.pkr.hcl is configured to run Packer in headless mode. Only Packer | ||
output will be seen. If you wish to see the installation output connect to the | ||
VNC port given in the Packer output or change the value of headless to false in | ||
ol8.pkr.hcl. | ||
|
||
Installation is non-interactive. | ||
|
||
## Uploading an image to MAAS | ||
|
||
```shell | ||
maas $PROFILE boot-resources create \ | ||
name='ol/8.8' title='Oracle Linux 8.8' \ | ||
architecture='amd64/generic' filetype='tgz' \ | ||
content@=ol8.tar.gz | ||
``` | ||
|
||
## Default Username | ||
|
||
The default username is ```cloud-user``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
url --url="https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64" ${KS_PROXY} | ||
poweroff | ||
firewall --enabled --service=ssh | ||
firstboot --disable | ||
ignoredisk --only-use=vda | ||
lang en_US.UTF-8 | ||
keyboard us | ||
network --device eth0 --bootproto=dhcp | ||
firewall --enabled --service=ssh | ||
selinux --enforcing | ||
timezone UTC --utc | ||
bootloader --location=mbr --driveorder="vda" --timeout=1 | ||
rootpw --plaintext password | ||
|
||
repo --name="ol8_AppStream" --baseurl="https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/" ${KS_PROXY} | ||
|
||
zerombr | ||
clearpart --all --initlabel | ||
part / --size=1 --grow --asprimary --fstype=ext4 | ||
|
||
%post --erroronfail | ||
# workaround anaconda requirements and clear root password | ||
passwd -d root | ||
passwd -l root | ||
|
||
# Clean up install config not applicable to deployed environments. | ||
for f in resolv.conf fstab; do | ||
rm -f /etc/$f | ||
touch /etc/$f | ||
chown root:root /etc/$f | ||
chmod 644 /etc/$f | ||
done | ||
|
||
rm -f /etc/sysconfig/network-scripts/ifcfg-[^lo]* | ||
|
||
# Kickstart copies install boot options. Serial is turned on for logging with | ||
# Packer which disables console output. Disable it so console output is shown | ||
# during deployments | ||
sed -i 's/^GRUB_TERMINAL=.*/GRUB_TERMINAL_OUTPUT="console"/g' /etc/default/grub | ||
sed -i '/GRUB_SERIAL_COMMAND="serial"/d' /etc/default/grub | ||
sed -ri 's/(GRUB_CMDLINE_LINUX=".*)\s+console=ttyS0(.*")/\1\2/' /etc/default/grub | ||
sed -i 's/"GRUB_ENABLE_BLSCFG=.*"/"GRUB_ENABLE_BLSCFG=false"/g' /etc/default/grub | ||
|
||
dnf clean all | ||
%end | ||
|
||
%packages | ||
@core | ||
bash-completion | ||
cloud-init | ||
# cloud-init only requires python3-oauthlib with MAAS. As such upstream | ||
# removed this dependency. | ||
python3-oauthlib | ||
rsync | ||
tar | ||
# grub2-efi-x64 ships grub signed for UEFI secure boot. If grub2-efi-x64-modules | ||
# is installed grub will be generated on deployment and unsigned which breaks | ||
# UEFI secure boot. | ||
grub2-efi-x64 | ||
efibootmgr | ||
shim-x64 | ||
dosfstools | ||
lvm2 | ||
mdadm | ||
device-mapper-multipath | ||
iscsi-initiator-utils | ||
-plymouth | ||
# Remove Intel wireless firmware | ||
-i*-firmware | ||
%end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
packer { | ||
required_version = ">= 1.7.0" | ||
required_plugins { | ||
qemu = { | ||
version = "~> 1.0" | ||
source = "github.com/hashicorp/qemu" | ||
} | ||
} | ||
} | ||
|
||
variable "filename" { | ||
type = string | ||
default = "ol8.tar.gz" | ||
description = "The filename of the tarball to produce" | ||
} | ||
|
||
variable "ol8_iso_url" { | ||
type = string | ||
default = "https://yum.oracle.com/ISOS/OracleLinux/OL8/u8/x86_64/x86_64-boot.iso" | ||
} | ||
|
||
variable "ol8_sha256sum_path" { | ||
type = string | ||
default = "https://linux.oracle.com/security/gpg/checksum/OracleLinux-R8-U8-Server-x86_64.checksum" | ||
} | ||
|
||
source "qemu" "ol8" { | ||
boot_command = ["<up><tab> ", "inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ol8.ks ", "console=ttyS0 inst.cmdline", "<enter>"] | ||
boot_wait = "3s" | ||
communicator = "none" | ||
disk_size = "4G" | ||
headless = true | ||
http_directory = "http" | ||
iso_checksum = "file:${var.ol8_sha256sum_path}" | ||
iso_url = var.ol8_iso_url | ||
memory = 2048 | ||
qemuargs = [["-serial", "stdio"], ["-cpu", "host"]] | ||
shutdown_timeout = "1h" | ||
} | ||
|
||
build { | ||
sources = ["source.qemu.ol8"] | ||
|
||
post-processor "shell-local" { | ||
inline = [ | ||
"SOURCE=ol8", | ||
"OUTPUT=${var.filename}", | ||
"source ../scripts/fuse-nbd", | ||
"source ../scripts/fuse-tar-root" | ||
] | ||
inline_shebang = "/bin/bash -e" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/make -f | ||
|
||
include ../scripts/check.mk | ||
|
||
PACKER ?= packer | ||
PACKER_LOG ?= 0 | ||
|
||
export PACKER_LOG KS_PROXY | ||
|
||
.PHONY: all clean | ||
|
||
all: ol9.tar.gz | ||
|
||
check-deps: | ||
$(call check_packages_deps) | ||
|
||
ol9.tar.gz: check-deps clean http/ol9.ks | ||
${PACKER} init ol9.pkr.hcl && ${PACKER} build ol9.pkr.hcl | ||
|
||
http/ol9.ks: http/ol9.ks.in | ||
envsubst '$${KS_PROXY}' < $< | tee $@ | ||
|
||
clean: | ||
${RM} -rf output-ol9 ol9.tar.gz http/ol9.ks | ||
|
||
.INTERMEDIATE: http/ol9.ks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# OL 9 Packer Template for MAAS | ||
|
||
## Introduction | ||
|
||
The Packer template in this directory creates an OL 9 AMD64 image for use with MAAS. | ||
|
||
## Prerequisites (to create the image) | ||
|
||
* A machine running Ubuntu 22.04+ with the ability to run KVM virtual machines. | ||
* qemu-utils, libnbd-bin, nbdkit and fuse2fs | ||
* [Packer](https://www.packer.io/intro/getting-started/install.html), v1.8.0 or newer | ||
|
||
## Requirements (to deploy the image) | ||
|
||
* [MAAS](https://maas.io) ___stamatis_version_replace_me___ | ||
* [Curtin](https://launchpad.net/curtin) ___stamatis_version_replace_me___ | ||
|
||
## Customizing the Image | ||
|
||
The deployment image may be customized by modifying http/ol9.ks. See the [OL9 kickstart documentation](https://docs.oracle.com/en/operating-systems/oracle-linux/9/install/install-AutomatinganOracleLinuxInstallationbyUsingKickstart.html) for more information. | ||
|
||
## Building the image using a proxy | ||
|
||
The Packer template downloads the OL net installer from the Internet. To | ||
tell Packer to use a proxy set the HTTP_PROXY environment variable to your proxy | ||
server. Alternatively you may redefine iso_url to a local file, set | ||
iso_checksum_type to none to disable checksuming, and remove iso_checksum_url. | ||
|
||
To use a proxy during the installation define the `KS_PROXY` variable in the | ||
environment, as bellow: | ||
|
||
```shell | ||
export KS_PROXY="--proxy=\"${HTTP_PROXY}\"" | ||
``` | ||
|
||
## Building an image | ||
|
||
You can easily build the image using the Makefile: | ||
|
||
```shell | ||
make | ||
``` | ||
|
||
Alternatively you can manually run packer. Your current working directory must | ||
be in packer-maas/ol9, where this file is located. Once in packer-maas/ol9 | ||
you can generate an image with: | ||
|
||
```shell | ||
packer init | ||
PACKER_LOG=1 packer build . | ||
``` | ||
|
||
Note: ol9.pkr.hcl is configured to run Packer in headless mode. Only Packer | ||
output will be seen. If you wish to see the installation output connect to the | ||
VNC port given in the Packer output or change the value of headless to false in | ||
ol9.pkr.hcl. | ||
|
||
Installation is non-interactive. | ||
|
||
## Uploading an image to MAAS | ||
|
||
```shell | ||
maas $PROFILE boot-resources create \ | ||
name='ol/9.2' title='Oracle Linux 9.2' \ | ||
architecture='amd64/generic' filetype='tgz' \ | ||
content@=ol9.tar.gz | ||
``` | ||
|
||
## Default Username | ||
|
||
The default username is ```cloud-user``` |
Oops, something went wrong.