Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rockylinux10/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Packer Build - Rocky Linux 10 minimal Vagrant Box

**Current Rocky Linux Version Used**: 10.1

See the [project README.md](../README.md) for usage instructions.
26 changes: 26 additions & 0 deletions rockylinux10/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.synced_folder '.', '/vagrant', type: 'nfs'

# VirtualBox.
config.vm.define "virtualbox" do |virtualbox|
virtualbox.vm.hostname = "virtualbox-rockylinux10"
virtualbox.vm.box = "file://builds/virtualbox-rockylinux10.box"
virtualbox.vm.network :private_network, ip: "192.168.56.2"
virtualbox.vm.synced_folder ".", "/vagrant", type: "nfs", nfs_version: "4"

config.vm.provider :virtualbox do |v|
v.gui = false
v.memory = 1024
v.cpus = 1
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--ioapic", "on"]
end

config.vm.provision "shell", inline: "echo Hello, World"
end

end
81 changes: 81 additions & 0 deletions rockylinux10/box-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"variables": {
"version": ""
},
"provisioners": [
{
"type": "shell",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/ansible.sh"
},
{
"type": "ansible-local",
"playbook_file": "../shared/main.yml",
"galaxy_file": "../shared/requirements.yml"
},
{
"type": "shell",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"script": "scripts/cleanup.sh"
}
],
"builders": [
{
"type": "virtualbox-iso",
"boot_command": [
"<wait><up><wait>e<wait><down><down><end><wait> inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg <leftCtrlOn>x<leftCtrlOff>"
],
"boot_wait": "10s",
"disk_size": 81920,
"guest_os_type": "RedHat_64",
"headless": true,
"http_directory": "http",
"iso_urls": [
"Rocky-10.1-x86_64-dvd1.iso",
"https://download.rockylinux.org/pub/rocky/8/isos/x86_64/Rocky-10.1-x86_64-dvd1.iso"
],
"iso_checksum": "sha256:55f96d45a052c0ed4f06309480155cb66281a008691eb7f3f359957205b1849a",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_port": 22,
"ssh_wait_timeout": "1800s",
"shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
"virtualbox_version_file": ".vbox_version",
"vm_name": "packer-rockylinux-10-x86_64",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"1"
],
[
"modifyvm",
"{{.Name}}",
"--nat-localhostreachable1",
"on"
]
]
}
],
"post-processors": [
[
{
"output": "builds/{{.Provider}}-rockylinux10.box",
"type": "vagrant"
},
{
"type": "vagrant-cloud",
"box_tag": "geerlingguy/rockylinux10",
"version": "{{user `version`}}"
}
]
]
}
1 change: 1 addition & 0 deletions rockylinux10/builds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This directory will contain built Vagrant box files.
81 changes: 81 additions & 0 deletions rockylinux10/http/ks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
cdrom
lang en_US.UTF-8
keyboard us
network --bootproto=dhcp
rootpw vagrant
firewall --disabled
selinux --permissive
timezone UTC
bootloader --location=mbr
text
skipx
zerombr
clearpart --all --initlabel
autopart
firstboot --disabled
eula --agreed
services --enabled=NetworkManager,sshd
user --name=vagrant --plaintext --password=vagrant --groups=wheel
reboot

%packages --ignoremissing --excludedocs
@Base
@Core
@Development Tools
openssh-clients
sudo
openssl-devel
readline-devel
zlib-devel
kernel-headers
kernel-devel
net-tools
vim
wget
curl
rsync

# unnecessary firmware
-aic94xx-firmware
-atmel-firmware
-b43-openfwwf
-bfa-firmware
-ipw2100-firmware
-ipw2200-firmware
-ivtv-firmware
-iwl100-firmware
-iwl1000-firmware
-iwl3945-firmware
-iwl4965-firmware
-iwl5000-firmware
-iwl5150-firmware
-iwl6000-firmware
-iwl6000g2a-firmware
-iwl6050-firmware
-libertas-usb8388-firmware
-ql2100-firmware
-ql2200-firmware
-ql23xx-firmware
-ql2400-firmware
-ql2500-firmware
-rt61pci-firmware
-rt73usb-firmware
-xorg-x11-drv-ati-firmware
-zd1211-firmware
%end

%post
yum update -y

# update root certs
wget -O/tmp/ca-bundle.crt https://curl.haxx.se/ca/cacert.pem

openssl x509 -text -in /tmp/ca-bundle.crt > /dev/null && mv /tmp/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt

# sudo
yum install -y sudo
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers

yum clean all
%end
11 changes: 11 additions & 0 deletions rockylinux10/scripts/ansible.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -eux

# Install Python.
yum -y install python3 python3-pip
alternatives --set python /usr/bin/python3

# Upgrade Pip.
python -m pip install -U pip

# Install Ansible.
pip3 install ansible
16 changes: 16 additions & 0 deletions rockylinux10/scripts/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash -eux

# Remove Ansible and its dependencies.
pip3 install pip-autoremove
ln -s /usr/bin/pip3 /usr/bin/pip
/usr/local/bin/pip-autoremove ansible -y
rm -f /usr/bin/pip
pip3 uninstall pip-autoremove -y

# Zero out the rest of the free space using dd, then delete the written file.
echo "Writing zeroes to free space (this could take a while)."
dd if=/dev/zero of=/EMPTY bs=1M || true
rm -f /EMPTY

# Add `sync` so Packer doesn't quit too early, before the large file is deleted.
sync