Question on provisioning RHEL like systems

hashjime

New Member
Feb 21, 2025
4
1
3
Hello again,
after a break I'm back at setting up my new home lab using Proxmox 8.3, OpenTofu 1.9.0 and Ansible.
My old setup was hyper-v core, Satellite Katello for unattended provisioning using PXE boot and tftp.

It took me some time to find out a way to replicate that workflow with my new setup. But with kvm_arguments I can sort of provision the same way.
The problem that I ran into now is that I get stuck in an infinite loop with the installer starting again after a reboot.

my tf file looks as follows:
Code:
resource "proxmox_virtual_environment_vm" "rocky_vm" {
  name      = "rocky-vm-02"
  node_name = "VMHOST1"
  kvm_arguments  = "-kernel /mnt/rocky/isolinux/vmlinuz -initrd /mnt/rocky/isolinux/initrd.img -append 'inst.ks=http://192.168.178.75/ks.cfg inst.cmdline quiet inst.once'"

  cpu {
    cores = 4
    type = "host"
  }

  memory {
    dedicated = 16348
  }

  network_device {
    bridge = "vmbr0"
  }

  startup {
    order = "1"
  }
  disk {
    datastore_id = "VMDISK1"
    file_format  = "qcow2"
    interface    = "scsi0"
    size         = 150
  }

  disk {
    datastore_id = "VMDISK1"
    file_format  = "qcow2"
    interface    = "scsi1"
    size         = 100  # Adjust the size as needed
  }

  cdrom {
    enabled = true
    file_id = "VMDISK1:iso/Rocky-9.5-x86_64-dvd.iso"
  }
}

My kickstart file as follows:

Code:
# Basic system configuration
lang en_US.UTF-8
keyboard sg
timezone UTC

# Installation source
# Assuming you're using the Rocky Linux DVD
cdrom

# Authentication
rootpw --iscrypted $6$randomsalt$randomhashhere
authselect --enableshadow --passalgo=sha512

# Network information (using DHCP)
network --bootproto=dhcp --device=link --activate

# Your existing partitioning scheme
zerombr
clearpart --all --initlabel
part /boot --fstype="ext4" --size=512
part /boot/efi --fstype="fat" --size=512
part pv.01 --size=1 --grow --ondisk=sda
volgroup vg_root --pesize=4096 pv.01
logvol / --fstype="ext4" --size=45000 --vgname=vg_root --name=lv_root
logvol /tmp --fstype="ext4" --size=1024 --vgname=vg_root --name=lv_tmp
logvol /var --fstype="ext4" --size=50120 --vgname=vg_root --name=lv_var
logvol /home --fstype="ext4" --size=512 --vgname=vg_root --name=lv_home
logvol swap --fstype="ext4" --size=16384 --vgname=vg_root --name=lv_swap
part pv.02 --size=1 --grow --ondisk=sdb
volgroup drbdpool --pesize=4096 pv.02

# System bootloader configuration
bootloader --location=mbr --boot-drive=sda

# Run the text install
text

# Skip X configuration
skipx

# Firewall configuration
firewall --enabled --service=ssh

# SELinux configuration
selinux --enforcing

# Do not configure the X Window System
skipx

# Reboot after installation
reboot --eject

# Package selection
%packages
@core
%end

# Post-installation script
%post
# Add any post-installation commands here
%end

The only way to break the loop is to go into the BIOS in the proxmox GUI and load from the scsi0 disk.

I tried to read the reference documentation : https://registry.terraform.io/provi...docs/resources/virtual_environment_vm#order-1
But could not really find a solution there. Also it's unclear to me what the startup order number represents. I could not find any reference on that any where.

All help appreciated.
 
Last edited:
Hello,
startup {
order = "1"
}
If you have multiple vm/lxc this defines the order for startup. Setting it to 1 will let Proxmox start this vm first. For shutdown of the node the order is processed in reverse, so this vm will be shutdown last.

For the reboot part I have no expertise, I am just wondering, about the kvm_arguments. Seems for me like they are provided in general and not just for first boot. Might be better to shutdown the vm after install, change the parameters, set a reasonable boot-order and boot the vm afterwards.
 
Thank you for clarifying the startup order.

I've tried as you mentioned to set "shutdown" instead of reboot. Once the system is down I could use:
qm set 103 --args ""
When starting up again the system boots correctly. So I guess the question is if that can be cone automated somehow ?
I see that tofu quits after creation of the vm and leaves the rest to the kickstart installation. Is there any way to make tofu wait for Proxmox to complete the installation maybe some event to listen to ?

I also realized that changing args to "" changes the boot order in the bios to scsi0 first and third "Legacy Option Rom". Before the legacy option rom was first in the boot sequence. Is there an attribute for the legacy rom that I can set here ?
boot_order = ["scsi0","ide3"]

Cheers,
Hashjime

Edit : I realized that I don't have to shutdown to execute the "qm set 103 --args "" " I can do that right after the installation starts. But still I'm trying to find an automated solution for this.
 
Last edited: