Skip to content

Commit

Permalink
feat: support building OracleLinux 9.4 base template
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoshkin committed Sep 19, 2024
1 parent 3f8b9c6 commit 187f5bf
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "rocky", "centos", "rhel", "flatcar"]
os: ["ubuntu", "rocky", "centos", "rhel", "oraclelinux", "flatcar"]
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu", "rocky", "centos", "rhel", "flatcar"]
os: ["ubuntu", "rocky", "centos", "rhel", "oraclelinux", "flatcar"]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ ubuntu-ovf-20: manifests/ovf/d2iq-base-Ubuntu-20.04$(NAME_POSTFIX).ovf
ubuntu-ovf-22: manifests/ovf/d2iq-base-Ubuntu-22.04$(NAME_POSTFIX).ovf
ubuntu-ovf: ubuntu-ovf-20 ubuntu-ovf-22


rocky: manifests/d2iq-base-RockyLinux-8.7$(NAME_POSTFIX).json manifests/d2iq-base-RockyLinux-9.1$(NAME_POSTFIX).json
rocky-test-87: manifests/tests/d2iq-base-RockyLinux-8.7$(NAME_POSTFIX).json.clean
rocky-test-87-clean: rocky-test-87 manifests/d2iq-base-RockyLinux-8.7$(NAME_POSTFIX).json.clean
Expand Down Expand Up @@ -96,6 +95,15 @@ rhel-ovf-86: manifests/ovf/d2iq-base-RHEL-86$(NAME_POSTFIX).ovf
rhel-ovf-88: manifests/ovf/d2iq-base-RHEL-88$(NAME_POSTFIX).ovf
rhel-ovf: rhel-ovf-79 rhel-ovf-84 rhel-ovf-86 rhel-ovf-88

oraclelinux: manifests/d2iq-base-OracleLinux-94$(NAME_POSTFIX).json
oraclelinux-test-94: manifests/tests/d2iq-base-OracleLinux-94$(NAME_POSTFIX).json.clean
oraclelinux-test-94-clean: oraclelinux-test-94 manifests/d2iq-base-OracleLinux-94$(NAME_POSTFIX).json.clean
oraclelinux-test: oraclelinux-test-94-clean
oraclelinux-release-94: oraclelinux-test-94 release/d2iq-base-OracleLinux-94$(NAME_POSTFIX)
oraclelinux-release: oraclelinux-release-94
oraclelinux-ovf-94: manifests/ovf/d2iq-base-OracleLinux-94$(NAME_POSTFIX).ovf
oraclelinux-ovf: oraclelinux-ovf-94

flatcar: manifests/d2iq-base-Flatcar-3033.3.16$(NAME_POSTFIX).json
flatcar-test-3033: manifests/tests/d2iq-base-Flatcar-3033.3.16$(NAME_POSTFIX).json
flatcar-test-3033-clean: flatcar-test-3033 manifests/d2iq-base-Flatcar-3033.3.16$(NAME_POSTFIX).json.clean
Expand All @@ -106,5 +114,5 @@ flatcar-ovf-3033: manifests/ovf/d2iq-base-Flatcar-3033.3.16$(NAME_POSTFIX).ovf
flatcar-ovf: flatcar-ovf-3033


test-all: ubuntu-test rocky-test centos-test rhel-test
release: ubuntu-release rocky-release centos-release rhel-release
test-all: ubuntu-test rocky-test centos-test rhel-test ol-test
release: ubuntu-release rocky-release centos-release rhel-release ol-release
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ There are distribution based make targets for building images
- `make ubuntu` - Ubuntu 20.04 and 22.04
- `make rocky` - Ubuntu 8 and 9
- `make centos` - Centos 7.9
- `make oraclelinux` - OracleLinux 9.10
- `make flatcar` - Flatcar LTS
- `make rhel` - RHEL 7.9, 8.4, 8.6 and 8.8

Expand Down
87 changes: 87 additions & 0 deletions bootfiles/oraclelinux/oraclelinux9.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cdrom
# Use text mode install
text

# License agreement
eula --agreed

# System language
lang en_US.UTF-8

# Keyboard layout
keyboard --vckeymap=us --xlayouts='us'





# Network information
network --bootproto=dhcp --device=link --activate

### Lock the root account
rootpw --lock

firewall --disabled

# SELinux configuration
selinux --permissive

# Do not configure the X Window System
skipx

# System timezone
timezone UTC

# Add a user named builder
user --name=${ssh_username}
sshkey --username=${ssh_username} "${public_key}"

# System bootloader configuration
bootloader --location=mbr

# Clear the Master Boot Record
zerombr

clearpart --all --initlabel
part / --fstype="ext4" --grow --asprimary --label=slash --ondisk=sda

%packages --excludedocs
# dnf group info minimal-environment
@^minimal-environment
@core
openssh-server
sed
sudo
python3
open-vm-tools

# Exclude unnecessary firmwares
-iwl*firmware
%end

# Enable/disable the following services
services --enabled=sshd

%post --logfile=/mnt/sysimage/root/ks-post.log --erroronfail
# Disable quiet boot and splash screen
sed --follow-symlinks -i "s/ rhgb quiet//" /etc/default/grub
sed --follow-symlinks -i "s/ rhgb quiet//" /boot/grub2/grubenv
# Passwordless sudo for the user '${ssh_username}'
echo "${ssh_username} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/${ssh_username}
chmod 440 /etc/sudoers.d/${ssh_username}

# Remove the package cache
dnf makecache
dnf install epel-release -y
dnf makecache
dnf install -y sudo open-vm-tools perl cloud-init cloud-utils-growpart

# Disable swap
swapoff -a
rm -f /swapfile
sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
sed -i '/^\(HWADDR\|UUID\)=/d' /etc/sysconfig/network-scripts/ifcfg-* || true
%end

# Reboot after successful installation
reboot
4 changes: 4 additions & 0 deletions images/base-OracleLinux-94.pkrvar.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
distribution="OracleLinux"
distribution_version="9.4"
iso_url="https://yum.oracle.com/ISOS/OracleLinux/OL9/u4/x86_64/OracleLinux-R9-U4-x86_64-dvd.iso"
iso_checksum="77034a4945474cb7c77820bd299cac9a557b8a298a5810c31d63ce404ad13c5e"
28 changes: 18 additions & 10 deletions vsphere.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ locals {
"RockyLinux-8.7" = "${path.root}/bootfiles/rocky/rocky-vault.ks"
"RockyLinux-9.1" = "${path.root}/bootfiles/rocky/rocky-vault.ks"
"CentOS" = "${path.root}/bootfiles/centos/centos7.ks"
"OracleLinux" = "${path.root}/bootfiles/oraclelinux/oraclelinux9.ks"
"Ubuntu" = "${path.root}/bootfiles/ubuntu/autoinstall.yaml"
"Ubuntu-18.04" = "${path.root}/bootfiles/ubuntu/preseed.cfg"
"Flatcar" = "${path.root}/bootfiles/flatcar/bootfile.sh.tmpl"
Expand Down Expand Up @@ -275,6 +276,7 @@ locals {
"RHEL" = local.el_bootcommand
"CentOS" = local.el_old_bootcommand
"RockyLinux" = local.el_bootcommand
"OracleLinux" = local.el_bootcommand
"Ubuntu-18.04" = local.ubuntu_bionic_bootcommand
"Ubuntu-20.04" = local.ubuntu_bootcommand
"Ubuntu-22.04" = local.ubuntu_jammy_bootcommand
Expand Down Expand Up @@ -302,20 +304,22 @@ locals {
default_vsphere_guest_os_type = "otherlinux64guest"

distro_vsphere_guest_os_type_lookup = {
"Ubuntu" = "ubuntu64Guest",
"CentOS" = "centos64Guest",
"RHEL" = "rhel7_64Guest"
"RockyLinux" = "centos64Guest"
"Flatcar" = "otherlinux64Guest"
"Ubuntu" = "ubuntu64Guest",
"CentOS" = "centos64Guest",
"RHEL" = "rhel7_64Guest"
"RockyLinux" = "centos64Guest"
"OracleLinux" = "oracleLinux64Guest"
"Flatcar" = "otherlinux64Guest"
}

# lookup by <distro_name>-<distro_version> fallback to <distro_name>
distro_default_ssh_username = {
"Ubuntu" = "ubuntu",
"CentOS" = "centos",
"RHEL" = "eluser"
"RockyLinux" = "rockstar"
"Flatcar" = "core"
"Ubuntu" = "ubuntu",
"CentOS" = "centos",
"RHEL" = "eluser"
"RockyLinux" = "rockstar"
"OracleLinux" = "opc"
"Flatcar" = "core"
}

boot_command_distro = lookup(local.distro_boot_command_lookup, "${var.distribution}", [""])
Expand Down Expand Up @@ -434,6 +438,10 @@ locals {
"${path.root}/scripts/el/install_open_vm_tools.sh",
"${path.root}/scripts/el/cleanup_dnf.sh"
],
"OracleLinux" = [
"${path.root}/scripts/el/install_open_vm_tools.sh",
"${path.root}/scripts/el/cleanup_dnf.sh"
],
"Flatcar" = [
"${path.root}/scripts/flatcar/no_autologin.sh",
"${path.root}/scripts/flatcar/clean.sh",
Expand Down

0 comments on commit 187f5bf

Please sign in to comment.