Merge branch 'add_distros' into 'main'
Add distros See merge request greg/vms!8
This commit is contained in:
@@ -12,6 +12,7 @@ Vagrantfile
|
|||||||
distros/fedora/rawhide/*.hcl
|
distros/fedora/rawhide/*.hcl
|
||||||
distros/nixos/**/*.hcl
|
distros/nixos/**/*.hcl
|
||||||
distros/centos-stream/**/*.hcl
|
distros/centos-stream/**/*.hcl
|
||||||
|
distros/opensuse/tumbleweed/*.hcl
|
||||||
|
|
||||||
__pycache__
|
__pycache__
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ stages:
|
|||||||
variables: &variables
|
variables: &variables
|
||||||
PACKER_CONFIG_DIR: ./packer_config/
|
PACKER_CONFIG_DIR: ./packer_config/
|
||||||
PACKER_CACHE_DIR: ./packer_cache/
|
PACKER_CACHE_DIR: ./packer_cache/
|
||||||
PACKER_LOG: 0
|
PACKER_LOG: 1
|
||||||
COMMAND: >
|
COMMAND: >
|
||||||
packer build ${only}
|
packer build ${only}
|
||||||
-var-file="${distro}"
|
-var-file="${distro}"
|
||||||
@@ -45,7 +45,6 @@ stages:
|
|||||||
- packer init sources
|
- packer init sources
|
||||||
- echo $COMMAND
|
- echo $COMMAND
|
||||||
script:
|
script:
|
||||||
- export EFI_DIR="$(dirname "$(find /nix/store -name OVMF_VARS.fd | head -1)")/"
|
|
||||||
- echo $COMMAND > build.sh
|
- echo $COMMAND > build.sh
|
||||||
- bash build.sh || exit 1
|
- bash build.sh || exit 1
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
Distros:
|
Distros:
|
||||||
* Arch -- Done
|
* Arch -- Done
|
||||||
* NixOS -- Done
|
* NixOS -- Done
|
||||||
* Alpine
|
* Alpine -- Done
|
||||||
* SuSE
|
* SuSE -- Done
|
||||||
* PopOS
|
* PopOS
|
||||||
* Mint
|
* Mint
|
||||||
* Rocky
|
* Rocky -- Done
|
||||||
* Alma
|
* Alma -- Done
|
||||||
* Oracle
|
* Oracle
|
||||||
* Gentoo
|
* Gentoo
|
||||||
* Elementary OS
|
* Elementary OS
|
||||||
* Manjaro
|
* Manjaro
|
||||||
|
|
||||||
Providers:
|
Providers:
|
||||||
* VMWare -- Done
|
* VMWare -- Done, but can't seem to automate install
|
||||||
* Parallels -- Requires money
|
* Parallels -- Requires money
|
||||||
* Hyper-V -- Done
|
* Hyper-V -- Done
|
||||||
|
|
||||||
|
|||||||
@@ -47,13 +47,13 @@ def process_distro(distro):
|
|||||||
process_builds(distro.builds)
|
process_builds(distro.builds)
|
||||||
|
|
||||||
def process_builds(builds):
|
def process_builds(builds):
|
||||||
for build in builds:
|
for build in builds:
|
||||||
if args.build:
|
if args.build:
|
||||||
name, arch = args.build.split(".")
|
name, arch = args.build.split(".")
|
||||||
if build.provider.name == name and build.provider.arch == arch:
|
if build.provider.name == name and build.provider.arch == arch:
|
||||||
do_build(build)
|
|
||||||
else:
|
|
||||||
do_build(build)
|
do_build(build)
|
||||||
|
else:
|
||||||
|
do_build(build)
|
||||||
|
|
||||||
def do_build(build):
|
def do_build(build):
|
||||||
if args.headless:
|
if args.headless:
|
||||||
|
|||||||
+2
-2
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
virsh -q vol-list default | awk '{print $1}' | xargs -r -L 1 virsh vol-delete --pool default
|
virsh -q vol-list default | awk '{print $1}' | xargs -r -L 1 virsh vol-delete --pool default
|
||||||
sudo virsh -q vol-list default | awk '{print $1}' | sudo xargs -r -L 1 virsh vol-delete --pool default
|
sudo virsh -q vol-list default | awk '{print $1}' | sudo xargs -r -L 1 virsh vol-delete --pool default
|
||||||
vagrant box list | grep virtualbox | awk '{print $1}' | sort -u | xargs -l vagrant box remove --provider virtualbox --force
|
vagrant box list | grep virtualbox | awk '{print $1}' | sort -u | xargs -r -l vagrant box remove --provider virtualbox --force
|
||||||
vagrant box list | grep libvirt | awk '{print $1}' | sort -u | xargs -l vagrant box remove --provider libvirt --force
|
vagrant box list | grep libvirt | awk '{print $1}' | sort -u | xargs -r -l vagrant box remove --provider libvirt --force
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
distro = "almalinux"
|
||||||
|
version = "8"
|
||||||
|
iso = {
|
||||||
|
url = "https://mirrors.kernel.org/almalinux/8.9/isos/x86_64/AlmaLinux-8.9-x86_64-boot.iso"
|
||||||
|
checksum = "ab861d80c8b68634f3c16d414a4141759a082548ad7b251d8924675fa09decab"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"<up>e<wait>",
|
||||||
|
"<down><down><end><wait>",
|
||||||
|
" inst.text inst.ks=cdrom:/ks.cfg",
|
||||||
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
|
]
|
||||||
|
cd_files = [ "distros/almalinux/8/disc/*" ]
|
||||||
|
vbox_os_type = "RedHat8_64"
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
url --mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos
|
||||||
|
repo --name=AppStream --mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream
|
||||||
|
network --bootproto=dhcp --activate
|
||||||
|
reboot
|
||||||
|
|
||||||
|
text
|
||||||
|
keyboard --vckeymap us
|
||||||
|
lang en_US
|
||||||
|
skipx
|
||||||
|
rootpw --plaintext vagrant
|
||||||
|
firewall --disabled
|
||||||
|
timezone --utc UTC
|
||||||
|
services --enabled=vmtoolsd
|
||||||
|
# The biosdevname and ifnames options ensure we get "eth0" as our interface
|
||||||
|
# even in environments like virtualbox that emulate a real NW card
|
||||||
|
bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop"
|
||||||
|
zerombr
|
||||||
|
clearpart --all
|
||||||
|
autopart --type=plain
|
||||||
|
|
||||||
|
user --name=vagrant --plaintext --password=vagrant
|
||||||
|
|
||||||
|
%packages --instLangs=en
|
||||||
|
bash-completion
|
||||||
|
man-pages
|
||||||
|
bzip2
|
||||||
|
rsync
|
||||||
|
nfs-utils
|
||||||
|
cifs-utils
|
||||||
|
chrony
|
||||||
|
yum-utils
|
||||||
|
hyperv-daemons
|
||||||
|
open-vm-tools
|
||||||
|
# Vagrant boxes aren't normally visible, no need for Plymouth
|
||||||
|
-plymouth
|
||||||
|
# Microcode updates cannot work in a VM
|
||||||
|
-microcode_ctl
|
||||||
|
# Firmware packages are not needed in a VM
|
||||||
|
-iwl100-firmware
|
||||||
|
-iwl1000-firmware
|
||||||
|
-iwl105-firmware
|
||||||
|
-iwl135-firmware
|
||||||
|
-iwl2000-firmware
|
||||||
|
-iwl2030-firmware
|
||||||
|
-iwl3160-firmware
|
||||||
|
-iwl3945-firmware
|
||||||
|
-iwl4965-firmware
|
||||||
|
-iwl5000-firmware
|
||||||
|
-iwl5150-firmware
|
||||||
|
-iwl6000-firmware
|
||||||
|
-iwl6000g2a-firmware
|
||||||
|
-iwl6050-firmware
|
||||||
|
-iwl7260-firmware
|
||||||
|
# Don't build rescue initramfs
|
||||||
|
-dracut-config-rescue
|
||||||
|
%end
|
||||||
|
|
||||||
|
# kdump needs to reserve 160MB + 2bits/4kB RAM, and automatic allocation only
|
||||||
|
# works on systems with at least 2GB RAM (which excludes most Vagrant boxes)
|
||||||
|
# CBS doesn't support %addon yet https://bugs.centos.org/view.php?id=12169
|
||||||
|
%addon com_redhat_kdump --disable
|
||||||
|
%end
|
||||||
|
|
||||||
|
%post --erroronfail
|
||||||
|
dnf update -y
|
||||||
|
|
||||||
|
# configure swap to a file
|
||||||
|
fallocate -l 2G /swapfile
|
||||||
|
chmod 600 /swapfile
|
||||||
|
mkswap /swapfile
|
||||||
|
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
|
||||||
|
|
||||||
|
# sudo
|
||||||
|
echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant
|
||||||
|
chmod 0440 /etc/sudoers.d/vagrant
|
||||||
|
|
||||||
|
# Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38
|
||||||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||||||
|
DEVICE="eth0"
|
||||||
|
BOOTPROTO="dhcp"
|
||||||
|
ONBOOT="yes"
|
||||||
|
TYPE="Ethernet"
|
||||||
|
PERSISTENT_DHCLIENT="yes"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# sshd: disable password authentication and DNS checks
|
||||||
|
ex -s /etc/ssh/sshd_config <<EOF
|
||||||
|
:%substitute/^.*\(PasswordAuthentication\) yes$/\1 yes/
|
||||||
|
:%substitute/^#\(UseDNS\) yes$/&\r\1 no/
|
||||||
|
:update
|
||||||
|
:quit
|
||||||
|
EOF
|
||||||
|
cat >>/etc/sysconfig/sshd <<EOF
|
||||||
|
echo PubkeyAcceptedKeyTypes +ssh-rsa >> /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
# Decrease connection time by preventing reverse DNS lookups
|
||||||
|
# (see https://lists.centos.org/pipermail/centos-devel/2016-July/014981.html
|
||||||
|
# and man sshd for more information)
|
||||||
|
OPTIONS="-u0"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Fix for issue #76, regular users can gain admin privileges via su
|
||||||
|
ex -s /etc/pam.d/su <<'EOF'
|
||||||
|
# allow vagrant to use su, but prevent others from becoming root or vagrant
|
||||||
|
/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/
|
||||||
|
:append
|
||||||
|
account [success=1 default=ignore] \\
|
||||||
|
pam_succeed_if.so user = vagrant use_uid quiet
|
||||||
|
account required pam_succeed_if.so user notin root:vagrant
|
||||||
|
.
|
||||||
|
:update
|
||||||
|
:quit
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# systemd should generate a new machine id during the first boot, to
|
||||||
|
# avoid having multiple Vagrant instances with the same id in the local
|
||||||
|
# network. /etc/machine-id should be empty, but it must exist to prevent
|
||||||
|
# boot errors (e.g. systemd-journald failing to start).
|
||||||
|
:>/etc/machine-id
|
||||||
|
|
||||||
|
echo 'vag' > /etc/yum/vars/infra
|
||||||
|
|
||||||
|
# Blacklist the floppy module to avoid probing timeouts
|
||||||
|
echo blacklist floppy > /etc/modprobe.d/nofloppy.conf
|
||||||
|
chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf
|
||||||
|
|
||||||
|
# Customize the initramfs
|
||||||
|
pushd /etc/dracut.conf.d
|
||||||
|
# Enable VMware PVSCSI support for VMware Fusion guests.
|
||||||
|
echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf
|
||||||
|
echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf
|
||||||
|
# There's no floppy controller, but probing for it generates timeouts
|
||||||
|
echo 'omit_drivers+=" floppy "' > nofloppy.conf
|
||||||
|
popd
|
||||||
|
# Fix the SELinux context of the new files
|
||||||
|
restorecon -f - <<EOF
|
||||||
|
/etc/sudoers.d/vagrant
|
||||||
|
/etc/dracut.conf.d/vmware-fusion-drivers.conf
|
||||||
|
/etc/dracut.conf.d/hyperv-drivers.conf
|
||||||
|
/etc/dracut.conf.d/nofloppy.conf
|
||||||
|
EOF
|
||||||
|
|
||||||
|
virt="$(systemd-detect-virt)"
|
||||||
|
if [ "${virt}" == "microsoft" ]; then
|
||||||
|
systemctl enable hpervfcopyd
|
||||||
|
systemctl enable hypervkvpd
|
||||||
|
systemctl enable hypervvssd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rerun dracut for the installed kernel (not the running kernel):
|
||||||
|
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
|
||||||
|
dracut -f /boot/initramfs-${KERNEL_VERSION}.img ${KERNEL_VERSION}
|
||||||
|
|
||||||
|
# Seal for deployment
|
||||||
|
rm -rf /etc/ssh/ssh_host_*
|
||||||
|
hostnamectl set-hostname localhost.localdomain
|
||||||
|
rm -rf /etc/udev/rules.d/70-*
|
||||||
|
%end
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf clean all
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf install -y qemu-guest-agent
|
||||||
|
systemctl start qemu-guest-agent
|
||||||
|
systemctl enable qemu-guest-agent
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
packages=(gcc make bzip2 kernel-devel elfutils-libelf-devel)
|
||||||
|
dnf install -y "${packages[@]}"
|
||||||
|
mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt
|
||||||
|
/mnt/VBoxLinuxAdditions.run install --nox11 2>&1 | tee /root/vbox_addon_install.log
|
||||||
|
umount /mnt
|
||||||
|
rm /home/vagrant/VBoxGuestAdditions.iso
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf install -y open-vm-tools
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
distro = "almalinux"
|
||||||
|
version = "9"
|
||||||
|
iso = {
|
||||||
|
url = "https://mirrors.kernel.org/almalinux/9.3/isos/x86_64/AlmaLinux-9.3-x86_64-boot.iso"
|
||||||
|
checksum = "af5377a1d16bbe599ea91a8761ad645f2f54687075802bdc0c0703ee610182e9"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"<up>e<wait>",
|
||||||
|
"<down><down><end><wait>",
|
||||||
|
" inst.text inst.ks=cdrom:/ks.cfg",
|
||||||
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
|
]
|
||||||
|
cd_files = [ "distros/almalinux/9/disc/*" ]
|
||||||
|
vbox_os_type = "RedHat9_64"
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
url --mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos
|
||||||
|
repo --name=AppStream --mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/appstream
|
||||||
|
network --bootproto=dhcp --activate
|
||||||
|
reboot
|
||||||
|
|
||||||
|
text
|
||||||
|
keyboard --vckeymap us
|
||||||
|
lang en_US
|
||||||
|
skipx
|
||||||
|
rootpw --plaintext vagrant
|
||||||
|
firewall --disabled
|
||||||
|
timezone --utc UTC
|
||||||
|
services --enabled=vmtoolsd
|
||||||
|
# The biosdevname and ifnames options ensure we get "eth0" as our interface
|
||||||
|
# even in environments like virtualbox that emulate a real NW card
|
||||||
|
bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop"
|
||||||
|
clearpart --all
|
||||||
|
autopart --type=plain
|
||||||
|
zerombr
|
||||||
|
|
||||||
|
user --name=vagrant --plaintext --password=vagrant
|
||||||
|
|
||||||
|
%packages --inst-langs=en
|
||||||
|
bash-completion
|
||||||
|
man-pages
|
||||||
|
bzip2
|
||||||
|
rsync
|
||||||
|
nfs-utils
|
||||||
|
cifs-utils
|
||||||
|
chrony
|
||||||
|
yum-utils
|
||||||
|
hyperv-daemons
|
||||||
|
open-vm-tools
|
||||||
|
# Vagrant boxes aren't normally visible, no need for Plymouth
|
||||||
|
-plymouth
|
||||||
|
# Microcode updates cannot work in a VM
|
||||||
|
-microcode_ctl
|
||||||
|
# Firmware packages are not needed in a VM
|
||||||
|
-iwl100-firmware
|
||||||
|
-iwl1000-firmware
|
||||||
|
-iwl105-firmware
|
||||||
|
-iwl135-firmware
|
||||||
|
-iwl2000-firmware
|
||||||
|
-iwl2030-firmware
|
||||||
|
-iwl3160-firmware
|
||||||
|
-iwl3945-firmware
|
||||||
|
-iwl4965-firmware
|
||||||
|
-iwl5000-firmware
|
||||||
|
-iwl5150-firmware
|
||||||
|
-iwl6000-firmware
|
||||||
|
-iwl6000g2a-firmware
|
||||||
|
-iwl6050-firmware
|
||||||
|
-iwl7260-firmware
|
||||||
|
# Don't build rescue initramfs
|
||||||
|
-dracut-config-rescue
|
||||||
|
%end
|
||||||
|
|
||||||
|
# kdump needs to reserve 160MB + 2bits/4kB RAM, and automatic allocation only
|
||||||
|
# works on systems with at least 2GB RAM (which excludes most Vagrant boxes)
|
||||||
|
# CBS doesn't support %addon yet https://bugs.centos.org/view.php?id=12169
|
||||||
|
%addon com_redhat_kdump --disable
|
||||||
|
%end
|
||||||
|
|
||||||
|
%post --erroronfail
|
||||||
|
dnf update -y
|
||||||
|
|
||||||
|
# configure swap to a file
|
||||||
|
fallocate -l 2G /swapfile
|
||||||
|
chmod 600 /swapfile
|
||||||
|
mkswap /swapfile
|
||||||
|
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
|
||||||
|
|
||||||
|
# sudo
|
||||||
|
echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant
|
||||||
|
chmod 0440 /etc/sudoers.d/vagrant
|
||||||
|
|
||||||
|
# Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38
|
||||||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||||||
|
DEVICE="eth0"
|
||||||
|
BOOTPROTO="dhcp"
|
||||||
|
ONBOOT="yes"
|
||||||
|
TYPE="Ethernet"
|
||||||
|
PERSISTENT_DHCLIENT="yes"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# sshd: disable password authentication and DNS checks
|
||||||
|
ex -s /etc/ssh/sshd_config <<EOF
|
||||||
|
:%substitute/^.*\(PasswordAuthentication\) yes$/\1 yes/
|
||||||
|
:%substitute/^#\(UseDNS\) yes$/&\r\1 no/
|
||||||
|
:update
|
||||||
|
:quit
|
||||||
|
EOF
|
||||||
|
cat >>/etc/sysconfig/sshd <<EOF
|
||||||
|
|
||||||
|
echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf
|
||||||
|
PubkeyAcceptedKeyTypes +ssh-rsa
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Decrease connection time by preventing reverse DNS lookups
|
||||||
|
# (see https://lists.centos.org/pipermail/centos-devel/2016-July/014981.html
|
||||||
|
# and man sshd for more information)
|
||||||
|
OPTIONS="-u0"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Fix for issue #76, regular users can gain admin privileges via su
|
||||||
|
ex -s /etc/pam.d/su <<'EOF'
|
||||||
|
# allow vagrant to use su, but prevent others from becoming root or vagrant
|
||||||
|
/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/
|
||||||
|
:append
|
||||||
|
account [success=1 default=ignore] \
|
||||||
|
pam_succeed_if.so user = vagrant use_uid quiet
|
||||||
|
account required pam_succeed_if.so user notin root:vagrant
|
||||||
|
.
|
||||||
|
:update
|
||||||
|
:quit
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# systemd should generate a new machine id during the first boot, to
|
||||||
|
# avoid having multiple Vagrant instances with the same id in the local
|
||||||
|
# network. /etc/machine-id should be empty, but it must exist to prevent
|
||||||
|
# boot errors (e.g. systemd-journald failing to start).
|
||||||
|
:>/etc/machine-id
|
||||||
|
|
||||||
|
echo 'vag' > /etc/yum/vars/infra
|
||||||
|
|
||||||
|
# Blacklist the floppy module to avoid probing timeouts
|
||||||
|
echo blacklist floppy > /etc/modprobe.d/nofloppy.conf
|
||||||
|
chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf
|
||||||
|
|
||||||
|
# Customize the initramfs
|
||||||
|
pushd /etc/dracut.conf.d
|
||||||
|
# Enable VMware PVSCSI support for VMware Fusion guests.
|
||||||
|
echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf
|
||||||
|
echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf
|
||||||
|
# There's no floppy controller, but probing for it generates timeouts
|
||||||
|
echo 'omit_drivers+=" floppy "' > nofloppy.conf
|
||||||
|
popd
|
||||||
|
# Fix the SELinux context of the new files
|
||||||
|
restorecon -f - <<EOF
|
||||||
|
/etc/sudoers.d/vagrant
|
||||||
|
/etc/dracut.conf.d/vmware-fusion-drivers.conf
|
||||||
|
/etc/dracut.conf.d/hyperv-drivers.conf
|
||||||
|
/etc/dracut.conf.d/nofloppy.conf
|
||||||
|
EOF
|
||||||
|
|
||||||
|
virt="$(systemd-detect-virt)"
|
||||||
|
if [ "${virt}" == "microsoft" ]; then
|
||||||
|
systemctl enable hpervfcopyd
|
||||||
|
systemctl enable hypervkvpd
|
||||||
|
systemctl enable hypervvssd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rerun dracut for the installed kernel (not the running kernel):
|
||||||
|
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
|
||||||
|
dracut -f /boot/initramfs-${KERNEL_VERSION}.img ${KERNEL_VERSION}
|
||||||
|
|
||||||
|
# Seal for deployment
|
||||||
|
rm -rf /etc/ssh/ssh_host_*
|
||||||
|
hostnamectl set-hostname localhost.localdomain
|
||||||
|
rm -rf /etc/udev/rules.d/70-*
|
||||||
|
%end
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf clean all
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf install -y qemu-guest-agent
|
||||||
|
systemctl start qemu-guest-agent
|
||||||
|
systemctl enable qemu-guest-agent
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
packages=(bzip2 kernel-devel kernel-headers make perl gcc)
|
||||||
|
dnf install -y "${packages[@]}"
|
||||||
|
mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt
|
||||||
|
/mnt/VBoxLinuxAdditions.run install --nox11 2>&1 | tee /root/vbox_addon_install.log
|
||||||
|
umount /mnt
|
||||||
|
rm /home/vagrant/VBoxGuestAdditions.iso
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf install -y open-vm-tools
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
8: &supp
|
||||||
|
- arch: amd64
|
||||||
|
provider: qemu
|
||||||
|
- arch: amd64
|
||||||
|
provider: virtualbox-iso
|
||||||
|
- arch: amd64
|
||||||
|
provider: vmware-iso
|
||||||
|
- arch: amd64
|
||||||
|
provider: hyperv-iso
|
||||||
|
9: *supp
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
distro = "alpine"
|
||||||
|
version = "3.19.0"
|
||||||
|
iso = {
|
||||||
|
url = "https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-standard-3.19.0-x86_64.iso"
|
||||||
|
checksum = "4cf7cd3bad64122a8a2423e78369a486a02334d4d88645aab9d08120bb76b0f9"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"root<enter><wait1>",
|
||||||
|
"echo 'iface eth0 inet dhcp' > /etc/network/interfaces<enter><wait>",
|
||||||
|
"ifup eth0<enter><wait8>",
|
||||||
|
"wget -O answers.cfg.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/answers.cfg.sh<enter>",
|
||||||
|
"<wait3>",
|
||||||
|
"wget -O in-chroot.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/in-chroot.sh<enter>",
|
||||||
|
"<wait3>",
|
||||||
|
"/bin/ash ./answers.cfg.sh 2>&1 | tee install.log<enter>",
|
||||||
|
]
|
||||||
|
http_directory = "distros/alpine/3.19.0/http/"
|
||||||
|
boot_wait = "20s"
|
||||||
|
shutdown_command = "sudo poweroff"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/ash
|
||||||
|
# shellcheck shell=dash
|
||||||
|
|
||||||
|
set -ex -o pipefail
|
||||||
|
|
||||||
|
if [ -e /dev/vda ]; then
|
||||||
|
disk="/dev/vda"
|
||||||
|
else
|
||||||
|
disk="/dev/sda"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat << EOF > answers.cfg
|
||||||
|
KEYMAPOPTS="us us"
|
||||||
|
|
||||||
|
HOSTNAMEOPTS="vagrant"
|
||||||
|
|
||||||
|
DEVDOPTS=mdev
|
||||||
|
|
||||||
|
INTERFACESOPTS="auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
auto eth0
|
||||||
|
iface eth0 inet dhcp
|
||||||
|
hostname vagrant.local"
|
||||||
|
|
||||||
|
TIMEZONEOPTS="UTC"
|
||||||
|
|
||||||
|
PROXYOPTS="none"
|
||||||
|
|
||||||
|
# Add first CDN mirror
|
||||||
|
APKREPOSOPTS="-1"
|
||||||
|
|
||||||
|
USEROPTS="-a -u -g audio,video,netdev vagrant"
|
||||||
|
|
||||||
|
SSHDOPTS=openssh
|
||||||
|
|
||||||
|
NTPOPTS=none
|
||||||
|
|
||||||
|
DISKOPTS="-m sys ${disk}"
|
||||||
|
|
||||||
|
LBUOPTS=none
|
||||||
|
|
||||||
|
APKCACHEOPTS=none
|
||||||
|
EOF
|
||||||
|
|
||||||
|
setup-alpine -e -f answers.cfg -q
|
||||||
|
yes y | setup-disk -m sys "${disk}" || true
|
||||||
|
# It isn't setting up disk in initial run, but
|
||||||
|
# it also can't setup disk before the rest of it
|
||||||
|
# is setup properly. There might be a better workaround
|
||||||
|
# but this is what I'm choosing to do
|
||||||
|
setup-alpine -e -f answers.cfg -q
|
||||||
|
|
||||||
|
mount "${disk}3" /mnt
|
||||||
|
mount "${disk}1" /mnt/boot
|
||||||
|
|
||||||
|
mv in-chroot.sh /mnt
|
||||||
|
for fs in proc sys dev sys/firmware/efi/efivars; do mount -o bind /${fs} /mnt/${fs}; done
|
||||||
|
chroot /mnt /bin/ash /in-chroot.sh
|
||||||
|
rm /mnt/in-chroot.sh
|
||||||
|
reboot
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
# Enables packages like "sudo"
|
||||||
|
sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories
|
||||||
|
|
||||||
|
# Install bare minimal packages
|
||||||
|
apk add curl efibootmgr openssh sudo virt-what
|
||||||
|
|
||||||
|
rc-update add sshd default
|
||||||
|
|
||||||
|
# Configure systems
|
||||||
|
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant-nopasswd
|
||||||
|
echo 'Defaults !requiretty' >> /etc/sudoers
|
||||||
|
sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
|
||||||
|
cat > /etc/ssh/sshd_config.d/10-vagrant-insecure-rsa-key.conf <<EOF
|
||||||
|
# For now the vagrant insecure key is an rsa key
|
||||||
|
# https://github.com/hashicorp/vagrant/issues/11783
|
||||||
|
PubkeyAcceptedKeyTypes=+ssh-rsa
|
||||||
|
EOF
|
||||||
|
ssh-keygen -A
|
||||||
|
|
||||||
|
# Create and configure the vagrant user
|
||||||
|
adduser vagrant -D
|
||||||
|
# Add the vagrant user to the `wheel` group
|
||||||
|
addgroup vagrant wheel
|
||||||
|
[ -d /home/vagrant ] || exit 1
|
||||||
|
echo "vagrant:vagrant" | chpasswd
|
||||||
|
echo "root:vagrant" | chpasswd
|
||||||
|
|
||||||
|
# Do host-specific things
|
||||||
|
virt="$(virt-what)"
|
||||||
|
# Values I've found so far
|
||||||
|
# "microsoft" == Hyper-V
|
||||||
|
# "oracle" == VirtualBox
|
||||||
|
# "KVM" == KVM/Qemu
|
||||||
|
case "${virt}" in
|
||||||
|
microsoft | hyperv)
|
||||||
|
apk add hvtools
|
||||||
|
rc-update add hv_fcopy_daemon
|
||||||
|
rc-update add hv_kvp_daemon
|
||||||
|
rc-update add hv_vss_daemon
|
||||||
|
target="0001" # Placeholder for now
|
||||||
|
;;
|
||||||
|
kvm | qemu)
|
||||||
|
apk add qemu-guest-agent
|
||||||
|
rc-update add qemu-guest-agent
|
||||||
|
target="$(efibootmgr | grep 'Misc' | awk '{print $1}' | sed -E 's/[^0-9]//g')"
|
||||||
|
;;
|
||||||
|
virtualbox*)
|
||||||
|
apk add virtualbox-guest-additions
|
||||||
|
rc-update add virtualbox-guest-additions boot
|
||||||
|
target="$(efibootmgr | grep 'VBOX HARD' | awk '{print $1}' | sed -E 's/[^0-9]//g')"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
efibootmgr --bootnext "${target}"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
pacman -Sy --noconfirm open-vm-tools
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
"3.19.0":
|
||||||
|
- arch: amd64
|
||||||
|
provider: qemu
|
||||||
|
- arch: amd64
|
||||||
|
provider: virtualbox-iso
|
||||||
|
- arch: amd64
|
||||||
|
provider: hyperv-iso
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
distro = "archlinux"
|
distro = "archlinux"
|
||||||
version = "rolling"
|
version = "rolling"
|
||||||
iso = {
|
iso = {
|
||||||
url = "http://mirror.rackspace.com/archlinux/iso/2024.01.01/archlinux-2024.01.01-x86_64.iso"
|
url = "http://mirror.rackspace.com/archlinux/iso/2024.04.01/archlinux-2024.04.01-x86_64.iso"
|
||||||
checksum = "12addd7d4154df1caf5f258b80ad72e7a724d33e75e6c2e6adc1475298d47155"
|
checksum = "52aea58f88c9a80afe64f0536da868251ef4878de5a5e0227fcada9f132bd7ab"
|
||||||
}
|
}
|
||||||
boot_command = [
|
boot_command = [
|
||||||
"e<down><down><down><end> net.ifnames=0 biosdevnames=0<f10>",
|
"e<down><down><down><end> net.ifnames=0 biosdevnames=0<f10>",
|
||||||
@@ -13,3 +13,4 @@ boot_command = [
|
|||||||
]
|
]
|
||||||
http_directory = "distros/archlinux/rolling/http/"
|
http_directory = "distros/archlinux/rolling/http/"
|
||||||
boot_wait = "10s"
|
boot_wait = "10s"
|
||||||
|
vbox_os_type = "ArchLinux_64"
|
||||||
|
|||||||
@@ -25,4 +25,5 @@ boot_command = [
|
|||||||
"<leftCtrlOn>x<leftCtrlOff>"
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
]
|
]
|
||||||
cd_files = [ "distros/centos-stream/8/disc/*" ]
|
cd_files = [ "distros/centos-stream/8/disc/*" ]
|
||||||
|
vbox_os_type = "RedHat8_64"
|
||||||
HERPDERP
|
HERPDERP
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ boot_command = [
|
|||||||
"<leftCtrlOn>x<leftCtrlOff>"
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
]
|
]
|
||||||
cd_files = [ "distros/centos-stream/9/disc/*" ]
|
cd_files = [ "distros/centos-stream/9/disc/*" ]
|
||||||
|
vbox_os_type = "RedHat9_64"
|
||||||
HERPDERP
|
HERPDERP
|
||||||
@@ -11,3 +11,4 @@ boot_command = [
|
|||||||
"<leftCtrlOn>x<leftCtrlOff>"
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
]
|
]
|
||||||
cd_files = ["distros/centos/7/disc/*"]
|
cd_files = ["distros/centos/7/disc/*"]
|
||||||
|
vbox_os_type = "RedHat7_64"
|
||||||
|
|||||||
@@ -19,3 +19,4 @@ boot_command = [
|
|||||||
"<f10>"
|
"<f10>"
|
||||||
]
|
]
|
||||||
http_directory = "distros/debian/10/http/"
|
http_directory = "distros/debian/10/http/"
|
||||||
|
vbox_os_type = "Debian10_64"
|
||||||
|
|||||||
@@ -19,3 +19,4 @@ boot_command = [
|
|||||||
"<f10>"
|
"<f10>"
|
||||||
]
|
]
|
||||||
http_directory = "distros/debian/11/http/"
|
http_directory = "distros/debian/11/http/"
|
||||||
|
vbox_os_type = "Debian11_64"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
distro = "debian"
|
distro = "debian"
|
||||||
version = "12"
|
version = "12"
|
||||||
iso = {
|
iso = {
|
||||||
url = "http://cdimage.debian.org/cdimage/release/12.4.0/amd64/iso-cd/debian-12.4.0-amd64-netinst.iso"
|
url = "http://cdimage.debian.org/cdimage/release/12.5.0/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso"
|
||||||
checksum = "64d727dd5785ae5fcfd3ae8ffbede5f40cca96f1580aaa2820e8b99dae989d94"
|
checksum = "013f5b44670d81280b5b1bc02455842b250df2f0c6763398feb69af1a805a14f"
|
||||||
}
|
}
|
||||||
boot_command = [
|
boot_command = [
|
||||||
"<down>e<wait><down><down><down><end><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
|
"<down>e<wait><down><down><down><end><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
|
||||||
@@ -19,3 +19,4 @@ boot_command = [
|
|||||||
"<f10>"
|
"<f10>"
|
||||||
]
|
]
|
||||||
http_directory = "distros/debian/12/http/"
|
http_directory = "distros/debian/12/http/"
|
||||||
|
vbox_os_type = "Debian12_64"
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ boot_command = [
|
|||||||
cd_files = [
|
cd_files = [
|
||||||
"distros/fedora/37/*.cfg"
|
"distros/fedora/37/*.cfg"
|
||||||
]
|
]
|
||||||
|
vbox_os_type = "Fedora_64"
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ boot_command = [
|
|||||||
cd_files = [
|
cd_files = [
|
||||||
"distros/fedora/38/*.cfg"
|
"distros/fedora/38/*.cfg"
|
||||||
]
|
]
|
||||||
|
vbox_os_type = "Fedora_64"
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ boot_command = [
|
|||||||
cd_files = [
|
cd_files = [
|
||||||
"distros/fedora/39/*.cfg"
|
"distros/fedora/39/*.cfg"
|
||||||
]
|
]
|
||||||
|
vbox_os_type = "Fedora_64"
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ boot_command = [
|
|||||||
cd_files = [
|
cd_files = [
|
||||||
"distros/fedora/rawhide/*.cfg"
|
"distros/fedora/rawhide/*.cfg"
|
||||||
]
|
]
|
||||||
|
vbox_os_type = "Fedora_64"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
rm -r "${tmp}"
|
rm -r "${tmp}"
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
distro = "opensuse"
|
||||||
|
version = "15.5"
|
||||||
|
iso = {
|
||||||
|
url = "https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-NET-x86_64-Media.iso"
|
||||||
|
checksum = "a2f7f2f1b6b3d3ef96f5c8f804d87ebd01e5cf982357c533f4c39c33cd20ec56"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"e<wait>",
|
||||||
|
"<down><down><down><down><end><wait>",
|
||||||
|
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
|
||||||
|
" autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1<wait>",
|
||||||
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
|
]
|
||||||
|
http_directory = "distros/opensuse/15.5/http/"
|
||||||
|
vbox_os_type = "OpenSUSE_Leap_64"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
zypper clean -a
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE profile>
|
||||||
|
<!-- https://doc.opensuse.org/projects/autoyast/#CreateProfile-General -->
|
||||||
|
<profile xmlns="http://www.suse.com/1.0/yast2ns"
|
||||||
|
xmlns:config="http://www.suse.com/1.0/configns">
|
||||||
|
<general>
|
||||||
|
<mode>
|
||||||
|
<confirm config:type="boolean">false</confirm>
|
||||||
|
<final_reboot config:type="boolean">true</final_reboot>
|
||||||
|
</mode>
|
||||||
|
</general>
|
||||||
|
<groups config:type="list">
|
||||||
|
<group>
|
||||||
|
<groupname>wheel</groupname>
|
||||||
|
<userlist>vagrant</userlist>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<groupname>vagrant</groupname>
|
||||||
|
<userlist>vagrant</userlist>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<firewall>
|
||||||
|
<enable_firewall config:type="boolean">true</enable_firewall>
|
||||||
|
<default_zone>external</default_zone>
|
||||||
|
<zones config:type="list">
|
||||||
|
<zone>
|
||||||
|
<name>public</name>
|
||||||
|
<interfaces config:type="list">
|
||||||
|
<interface>eth0</interface>
|
||||||
|
</interfaces>
|
||||||
|
<services config:type="list">
|
||||||
|
<service>ssh</service>
|
||||||
|
</services>
|
||||||
|
</zone>
|
||||||
|
</zones>
|
||||||
|
</firewall>
|
||||||
|
<partitioning config:type="list">
|
||||||
|
<drive>
|
||||||
|
<use>all</use>
|
||||||
|
<partitions config:type="list">
|
||||||
|
<partition>
|
||||||
|
<mount>/boot</mount>
|
||||||
|
<size>512MiB</size>
|
||||||
|
</partition>
|
||||||
|
<partition>
|
||||||
|
<mount>/</mount>
|
||||||
|
<size>max</size>
|
||||||
|
</partition>
|
||||||
|
</partitions>
|
||||||
|
</drive>
|
||||||
|
</partitioning>
|
||||||
|
<language>
|
||||||
|
<language>en_US</language>
|
||||||
|
</language>
|
||||||
|
<networking>
|
||||||
|
<backend>network_manager</backend>
|
||||||
|
</networking>
|
||||||
|
<services-manager>
|
||||||
|
<services>
|
||||||
|
<enable config:type="list">
|
||||||
|
<service>sshd</service>
|
||||||
|
</enable>
|
||||||
|
</services>
|
||||||
|
</services-manager>
|
||||||
|
<software>
|
||||||
|
<packages config:type="list">
|
||||||
|
<package>openssh</package>
|
||||||
|
<package>sudo</package>
|
||||||
|
</packages>
|
||||||
|
<do_online_update config:type="boolean">true</do_online_update>
|
||||||
|
<install_recommended config:type="boolean">false</install_recommended>
|
||||||
|
</software>
|
||||||
|
<timezone>
|
||||||
|
<hwclock>UTC</hwclock>
|
||||||
|
<timezone>UTC</timezone>
|
||||||
|
</timezone>
|
||||||
|
<users config:type="list">
|
||||||
|
<user>
|
||||||
|
<username>root</username>
|
||||||
|
<user_password>vagrant</user_password>
|
||||||
|
<encrypted config:type="boolean">false</encrypted>
|
||||||
|
</user>
|
||||||
|
<user>
|
||||||
|
<username>vagrant</username>
|
||||||
|
<user_password>vagrant</user_password>
|
||||||
|
<encrypted config:type="boolean">false</encrypted>
|
||||||
|
</user>
|
||||||
|
</users>
|
||||||
|
<scripts>
|
||||||
|
<pre-scripts config:type="list">
|
||||||
|
<script>
|
||||||
|
<interpreter>shell</interpreter>
|
||||||
|
<filename>start.sh</filename>
|
||||||
|
<!-- <location>some_url</location> -->
|
||||||
|
<source>
|
||||||
|
<![CDATA[
|
||||||
|
#!/bin/sh
|
||||||
|
echo "Starting installation"
|
||||||
|
exit 0
|
||||||
|
]]>
|
||||||
|
</source>
|
||||||
|
</script>
|
||||||
|
</pre-scripts>
|
||||||
|
</scripts>
|
||||||
|
<files config:type="list">
|
||||||
|
<file>
|
||||||
|
<file_path>/etc/sudoers.d/vagrant</file_path>
|
||||||
|
<file_contents>
|
||||||
|
<![CDATA[
|
||||||
|
Defaults:vagrant !requiretty
|
||||||
|
vagrant ALL=(ALL) NOPASSWD: ALL
|
||||||
|
root ALL=(ALL) NOPASSWD: ALL
|
||||||
|
]]>
|
||||||
|
</file_contents>
|
||||||
|
<file_permissions>440</file_permissions>
|
||||||
|
<file_owner>root</file_owner>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<file_path>/home/vagrant/.ssh/authorized_keys</file_path>
|
||||||
|
<file_permissions>600</file_permissions>
|
||||||
|
<file_owner>vagrant</file_owner>
|
||||||
|
<file_location>https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub</file_location>
|
||||||
|
</file>
|
||||||
|
</files>
|
||||||
|
</profile>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
zypper install -y qemu-guest-agent
|
||||||
|
systemctl start qemu-guest-agent
|
||||||
|
systemctl enable qemu-guest-agent
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
distro = "opensuse"
|
||||||
|
version = "15.6"
|
||||||
|
iso = {
|
||||||
|
url = "https://download.opensuse.org/distribution/leap/15.6/iso/openSUSE-Leap-15.6-NET-x86_64-Media.iso"
|
||||||
|
checksum = "4631636c43297951f1a0a3a2a804e30f4bf1790f892d0f0ac46f62ec82ac2075"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"e<wait>",
|
||||||
|
"<down><down><down><down><end><wait>",
|
||||||
|
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
|
||||||
|
" autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1<wait>",
|
||||||
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
|
]
|
||||||
|
http_directory = "distros/opensuse/15.6/http/"
|
||||||
|
vbox_os_type = "OpenSUSE_Leap_64"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
zypper clean -a
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE profile>
|
||||||
|
<!-- https://doc.opensuse.org/projects/autoyast/#CreateProfile-General -->
|
||||||
|
<profile xmlns="http://www.suse.com/1.0/yast2ns"
|
||||||
|
xmlns:config="http://www.suse.com/1.0/configns">
|
||||||
|
<general>
|
||||||
|
<mode>
|
||||||
|
<confirm config:type="boolean">false</confirm>
|
||||||
|
<final_reboot config:type="boolean">true</final_reboot>
|
||||||
|
</mode>
|
||||||
|
</general>
|
||||||
|
<groups config:type="list">
|
||||||
|
<group>
|
||||||
|
<groupname>wheel</groupname>
|
||||||
|
<userlist>vagrant</userlist>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<groupname>vagrant</groupname>
|
||||||
|
<userlist>vagrant</userlist>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<firewall>
|
||||||
|
<enable_firewall config:type="boolean">true</enable_firewall>
|
||||||
|
<default_zone>external</default_zone>
|
||||||
|
<zones config:type="list">
|
||||||
|
<zone>
|
||||||
|
<name>public</name>
|
||||||
|
<interfaces config:type="list">
|
||||||
|
<interface>eth0</interface>
|
||||||
|
</interfaces>
|
||||||
|
<services config:type="list">
|
||||||
|
<service>ssh</service>
|
||||||
|
</services>
|
||||||
|
</zone>
|
||||||
|
</zones>
|
||||||
|
</firewall>
|
||||||
|
<partitioning config:type="list">
|
||||||
|
<drive>
|
||||||
|
<use>all</use>
|
||||||
|
<partitions config:type="list">
|
||||||
|
<partition>
|
||||||
|
<mount>/boot</mount>
|
||||||
|
<size>512MiB</size>
|
||||||
|
</partition>
|
||||||
|
<partition>
|
||||||
|
<mount>/</mount>
|
||||||
|
<size>max</size>
|
||||||
|
</partition>
|
||||||
|
</partitions>
|
||||||
|
</drive>
|
||||||
|
</partitioning>
|
||||||
|
<language>
|
||||||
|
<language>en_US</language>
|
||||||
|
</language>
|
||||||
|
<networking>
|
||||||
|
<backend>network_manager</backend>
|
||||||
|
</networking>
|
||||||
|
<services-manager>
|
||||||
|
<services>
|
||||||
|
<enable config:type="list">
|
||||||
|
<service>sshd</service>
|
||||||
|
</enable>
|
||||||
|
</services>
|
||||||
|
</services-manager>
|
||||||
|
<software>
|
||||||
|
<packages config:type="list">
|
||||||
|
<package>openssh</package>
|
||||||
|
<package>sudo</package>
|
||||||
|
</packages>
|
||||||
|
<do_online_update config:type="boolean">true</do_online_update>
|
||||||
|
<install_recommended config:type="boolean">false</install_recommended>
|
||||||
|
</software>
|
||||||
|
<timezone>
|
||||||
|
<hwclock>UTC</hwclock>
|
||||||
|
<timezone>UTC</timezone>
|
||||||
|
</timezone>
|
||||||
|
<users config:type="list">
|
||||||
|
<user>
|
||||||
|
<username>root</username>
|
||||||
|
<user_password>vagrant</user_password>
|
||||||
|
<encrypted config:type="boolean">false</encrypted>
|
||||||
|
</user>
|
||||||
|
<user>
|
||||||
|
<username>vagrant</username>
|
||||||
|
<user_password>vagrant</user_password>
|
||||||
|
<encrypted config:type="boolean">false</encrypted>
|
||||||
|
</user>
|
||||||
|
</users>
|
||||||
|
<scripts>
|
||||||
|
<pre-scripts config:type="list">
|
||||||
|
<script>
|
||||||
|
<interpreter>shell</interpreter>
|
||||||
|
<filename>start.sh</filename>
|
||||||
|
<!-- <location>some_url</location> -->
|
||||||
|
<source>
|
||||||
|
<![CDATA[
|
||||||
|
#!/bin/sh
|
||||||
|
echo "Starting installation"
|
||||||
|
exit 0
|
||||||
|
]]>
|
||||||
|
</source>
|
||||||
|
</script>
|
||||||
|
</pre-scripts>
|
||||||
|
</scripts>
|
||||||
|
<files config:type="list">
|
||||||
|
<file>
|
||||||
|
<file_path>/etc/sudoers.d/vagrant</file_path>
|
||||||
|
<file_contents>
|
||||||
|
<![CDATA[
|
||||||
|
Defaults:vagrant !requiretty
|
||||||
|
vagrant ALL=(ALL) NOPASSWD: ALL
|
||||||
|
root ALL=(ALL) NOPASSWD: ALL
|
||||||
|
]]>
|
||||||
|
</file_contents>
|
||||||
|
<file_permissions>440</file_permissions>
|
||||||
|
<file_owner>root</file_owner>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<file_path>/home/vagrant/.ssh/authorized_keys</file_path>
|
||||||
|
<file_permissions>600</file_permissions>
|
||||||
|
<file_owner>vagrant</file_owner>
|
||||||
|
<file_location>https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub</file_location>
|
||||||
|
</file>
|
||||||
|
</files>
|
||||||
|
</profile>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
zypper install -y qemu-guest-agent
|
||||||
|
systemctl start qemu-guest-agent
|
||||||
|
systemctl enable qemu-guest-agent
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
15.6: &supp
|
||||||
|
- arch: amd64
|
||||||
|
provider: qemu
|
||||||
|
- arch: amd64
|
||||||
|
provider: virtualbox-iso
|
||||||
|
- arch: amd64
|
||||||
|
provider: vmware-iso
|
||||||
|
- arch: amd64
|
||||||
|
provider: hyperv-iso
|
||||||
|
15.5: *supp
|
||||||
|
tumbleweed: *supp
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
name="${0%.sh}"
|
||||||
|
|
||||||
|
base="https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso"
|
||||||
|
|
||||||
|
# Working directory
|
||||||
|
tmp="$(mktemp -d)"
|
||||||
|
checksums="${tmp}/checksums"
|
||||||
|
|
||||||
|
# Read the SHA256 sum value
|
||||||
|
sums="${base}.sha256"
|
||||||
|
until curl -f -L -o "${checksums}" "${sums}"; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
sha="$(cut -d' ' -f 1 "${checksums}")"
|
||||||
|
|
||||||
|
cat << EOF > "${name}"
|
||||||
|
distro = "opensuse"
|
||||||
|
version = "tumbleweed"
|
||||||
|
iso = {
|
||||||
|
url = "${base}"
|
||||||
|
checksum = "${sha}"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"e<wait>",
|
||||||
|
"<down><down><down><down><end><wait>",
|
||||||
|
" autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1<wait>",
|
||||||
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
|
]
|
||||||
|
http_directory = "distros/opensuse/tumbleweed/http/"
|
||||||
|
vbox_os_type = "OpenSUSE_Tumbleweed_64"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -r "${tmp}"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
zypper clean -a
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE profile>
|
||||||
|
<!-- https://doc.opensuse.org/projects/autoyast/#CreateProfile-General -->
|
||||||
|
<profile xmlns="http://www.suse.com/1.0/yast2ns"
|
||||||
|
xmlns:config="http://www.suse.com/1.0/configns">
|
||||||
|
<general>
|
||||||
|
<mode>
|
||||||
|
<confirm config:type="boolean">false</confirm>
|
||||||
|
<final_reboot config:type="boolean">true</final_reboot>
|
||||||
|
</mode>
|
||||||
|
</general>
|
||||||
|
<groups config:type="list">
|
||||||
|
<group>
|
||||||
|
<groupname>wheel</groupname>
|
||||||
|
<userlist>vagrant</userlist>
|
||||||
|
</group>
|
||||||
|
</groups>
|
||||||
|
<firewall>
|
||||||
|
<enable_firewall config:type="boolean">true</enable_firewall>
|
||||||
|
<default_zone>external</default_zone>
|
||||||
|
<zones config:type="list">
|
||||||
|
<zone>
|
||||||
|
<name>public</name>
|
||||||
|
<interfaces config:type="list">
|
||||||
|
<interface>eth0</interface>
|
||||||
|
</interfaces>
|
||||||
|
<services config:type="list">
|
||||||
|
<service>ssh</service>
|
||||||
|
</services>
|
||||||
|
</zone>
|
||||||
|
</zones>
|
||||||
|
</firewall>
|
||||||
|
<partitioning config:type="list">
|
||||||
|
<drive>
|
||||||
|
<use>all</use>
|
||||||
|
<partitions config:type="list">
|
||||||
|
<partition>
|
||||||
|
<mount>/boot</mount>
|
||||||
|
<size>512MiB</size>
|
||||||
|
</partition>
|
||||||
|
<partition>
|
||||||
|
<mount>/</mount>
|
||||||
|
<size>max</size>
|
||||||
|
</partition>
|
||||||
|
</partitions>
|
||||||
|
</drive>
|
||||||
|
</partitioning>
|
||||||
|
<language>
|
||||||
|
<language>en_US</language>
|
||||||
|
</language>
|
||||||
|
<networking>
|
||||||
|
<backend>network_manager</backend>
|
||||||
|
</networking>
|
||||||
|
<services-manager>
|
||||||
|
<services>
|
||||||
|
<enable config:type="list">
|
||||||
|
<service>sshd</service>
|
||||||
|
</enable>
|
||||||
|
</services>
|
||||||
|
</services-manager>
|
||||||
|
<software>
|
||||||
|
<packages config:type="list">
|
||||||
|
<package>openssh</package>
|
||||||
|
<package>sudo</package>
|
||||||
|
</packages>
|
||||||
|
<do_online_update config:type="boolean">true</do_online_update>
|
||||||
|
<install_recommended config:type="boolean">false</install_recommended>
|
||||||
|
<products config:type="list">
|
||||||
|
<product>openSUSE</product>
|
||||||
|
</products>
|
||||||
|
</software>
|
||||||
|
<timezone>
|
||||||
|
<hwclock>UTC</hwclock>
|
||||||
|
<timezone>UTC</timezone>
|
||||||
|
</timezone>
|
||||||
|
<users config:type="list">
|
||||||
|
<user>
|
||||||
|
<username>root</username>
|
||||||
|
<user_password>vagrant</user_password>
|
||||||
|
<encrypted config:type="boolean">false</encrypted>
|
||||||
|
</user>
|
||||||
|
<user>
|
||||||
|
<username>vagrant</username>
|
||||||
|
<user_password>vagrant</user_password>
|
||||||
|
<encrypted config:type="boolean">false</encrypted>
|
||||||
|
</user>
|
||||||
|
</users>
|
||||||
|
<scripts>
|
||||||
|
<post-scripts config:type="list">
|
||||||
|
<script>
|
||||||
|
<interpreter>shell</interpreter>
|
||||||
|
<filename>start.sh</filename>
|
||||||
|
<!-- <location>some_url</location> -->
|
||||||
|
<source>
|
||||||
|
<![CDATA[
|
||||||
|
#!/bin/sh
|
||||||
|
echo "Starting installation"
|
||||||
|
]]>
|
||||||
|
</source>
|
||||||
|
</script>
|
||||||
|
</post-scripts>
|
||||||
|
</scripts>
|
||||||
|
<files config:type="list">
|
||||||
|
<file>
|
||||||
|
<file_path>/etc/sudoers.d/vagrant</file_path>
|
||||||
|
<file_contents>
|
||||||
|
<![CDATA[
|
||||||
|
Defaults:vagrant !requiretty
|
||||||
|
vagrant ALL=(ALL) NOPASSWD: ALL
|
||||||
|
root ALL=(ALL) NOPASSWD: ALL
|
||||||
|
]]>
|
||||||
|
</file_contents>
|
||||||
|
<file_permissions>440</file_permissions>
|
||||||
|
<file_owner>root</file_owner>
|
||||||
|
</file>
|
||||||
|
<file>
|
||||||
|
<file_path>/home/vagrant/.ssh/authorized_keys</file_path>
|
||||||
|
<file_permissions>600</file_permissions>
|
||||||
|
<file_owner>vagrant</file_owner>
|
||||||
|
<file_location>https://raw.githubusercontent.com/hashicorp/vagrant/master/keys/vagrant.pub</file_location>
|
||||||
|
</file>
|
||||||
|
</files>
|
||||||
|
</profile>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
zypper install -y qemu-guest-agent
|
||||||
|
systemctl start qemu-guest-agent
|
||||||
|
systemctl enable qemu-guest-agent
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
distro = "rockylinux"
|
||||||
|
version = "8"
|
||||||
|
iso = {
|
||||||
|
url = "https://download.rockylinux.org/pub/rocky/8/isos/x86_64/Rocky-8.9-x86_64-boot.iso"
|
||||||
|
checksum = "88baefca6f0e78b53613773954e0d7c2d8d28ad863f40623db75c40f505b5105"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"<up>e<wait>",
|
||||||
|
"<down><down><end><wait>",
|
||||||
|
" inst.text inst.ks=cdrom:/ks.cfg",
|
||||||
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
|
]
|
||||||
|
cd_files = [ "distros/rockylinux/8/disc/*" ]
|
||||||
|
vbox_os_type = "RedHat8_64"
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
url --mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rocky-BaseOS-$releasever
|
||||||
|
repo --name=AppStream --mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rocky-AppStream-$releasever
|
||||||
|
network --bootproto=dhcp --activate
|
||||||
|
reboot
|
||||||
|
|
||||||
|
text
|
||||||
|
keyboard --vckeymap us
|
||||||
|
lang en_US
|
||||||
|
skipx
|
||||||
|
rootpw --plaintext vagrant
|
||||||
|
firewall --disabled
|
||||||
|
timezone --utc UTC
|
||||||
|
services --enabled=vmtoolsd
|
||||||
|
# The biosdevname and ifnames options ensure we get "eth0" as our interface
|
||||||
|
# even in environments like virtualbox that emulate a real NW card
|
||||||
|
bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop"
|
||||||
|
zerombr
|
||||||
|
clearpart --all
|
||||||
|
autopart --type=plain
|
||||||
|
|
||||||
|
user --name=vagrant --plaintext --password=vagrant
|
||||||
|
|
||||||
|
%packages --instLangs=en
|
||||||
|
bash-completion
|
||||||
|
man-pages
|
||||||
|
bzip2
|
||||||
|
rsync
|
||||||
|
nfs-utils
|
||||||
|
cifs-utils
|
||||||
|
chrony
|
||||||
|
yum-utils
|
||||||
|
hyperv-daemons
|
||||||
|
open-vm-tools
|
||||||
|
# Vagrant boxes aren't normally visible, no need for Plymouth
|
||||||
|
-plymouth
|
||||||
|
# Microcode updates cannot work in a VM
|
||||||
|
-microcode_ctl
|
||||||
|
# Firmware packages are not needed in a VM
|
||||||
|
-iwl100-firmware
|
||||||
|
-iwl1000-firmware
|
||||||
|
-iwl105-firmware
|
||||||
|
-iwl135-firmware
|
||||||
|
-iwl2000-firmware
|
||||||
|
-iwl2030-firmware
|
||||||
|
-iwl3160-firmware
|
||||||
|
-iwl3945-firmware
|
||||||
|
-iwl4965-firmware
|
||||||
|
-iwl5000-firmware
|
||||||
|
-iwl5150-firmware
|
||||||
|
-iwl6000-firmware
|
||||||
|
-iwl6000g2a-firmware
|
||||||
|
-iwl6050-firmware
|
||||||
|
-iwl7260-firmware
|
||||||
|
# Don't build rescue initramfs
|
||||||
|
-dracut-config-rescue
|
||||||
|
%end
|
||||||
|
|
||||||
|
# kdump needs to reserve 160MB + 2bits/4kB RAM, and automatic allocation only
|
||||||
|
# works on systems with at least 2GB RAM (which excludes most Vagrant boxes)
|
||||||
|
# CBS doesn't support %addon yet https://bugs.centos.org/view.php?id=12169
|
||||||
|
%addon com_redhat_kdump --disable
|
||||||
|
%end
|
||||||
|
|
||||||
|
%post --erroronfail
|
||||||
|
dnf update -y
|
||||||
|
|
||||||
|
# configure swap to a file
|
||||||
|
fallocate -l 2G /swapfile
|
||||||
|
chmod 600 /swapfile
|
||||||
|
mkswap /swapfile
|
||||||
|
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
|
||||||
|
|
||||||
|
# sudo
|
||||||
|
echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant
|
||||||
|
chmod 0440 /etc/sudoers.d/vagrant
|
||||||
|
|
||||||
|
# Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38
|
||||||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||||||
|
DEVICE="eth0"
|
||||||
|
BOOTPROTO="dhcp"
|
||||||
|
ONBOOT="yes"
|
||||||
|
TYPE="Ethernet"
|
||||||
|
PERSISTENT_DHCLIENT="yes"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# sshd: disable password authentication and DNS checks
|
||||||
|
ex -s /etc/ssh/sshd_config <<EOF
|
||||||
|
:%substitute/^.*\(PasswordAuthentication\) yes$/\1 yes/
|
||||||
|
:%substitute/^#\(UseDNS\) yes$/&\r\1 no/
|
||||||
|
:update
|
||||||
|
:quit
|
||||||
|
EOF
|
||||||
|
cat >>/etc/sysconfig/sshd <<EOF
|
||||||
|
echo PubkeyAcceptedKeyTypes +ssh-rsa >> /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
# Decrease connection time by preventing reverse DNS lookups
|
||||||
|
# (see https://lists.centos.org/pipermail/centos-devel/2016-July/014981.html
|
||||||
|
# and man sshd for more information)
|
||||||
|
OPTIONS="-u0"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Fix for issue #76, regular users can gain admin privileges via su
|
||||||
|
ex -s /etc/pam.d/su <<'EOF'
|
||||||
|
# allow vagrant to use su, but prevent others from becoming root or vagrant
|
||||||
|
/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/
|
||||||
|
:append
|
||||||
|
account [success=1 default=ignore] \\
|
||||||
|
pam_succeed_if.so user = vagrant use_uid quiet
|
||||||
|
account required pam_succeed_if.so user notin root:vagrant
|
||||||
|
.
|
||||||
|
:update
|
||||||
|
:quit
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# systemd should generate a new machine id during the first boot, to
|
||||||
|
# avoid having multiple Vagrant instances with the same id in the local
|
||||||
|
# network. /etc/machine-id should be empty, but it must exist to prevent
|
||||||
|
# boot errors (e.g. systemd-journald failing to start).
|
||||||
|
:>/etc/machine-id
|
||||||
|
|
||||||
|
echo 'vag' > /etc/yum/vars/infra
|
||||||
|
|
||||||
|
# Blacklist the floppy module to avoid probing timeouts
|
||||||
|
echo blacklist floppy > /etc/modprobe.d/nofloppy.conf
|
||||||
|
chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf
|
||||||
|
|
||||||
|
# Customize the initramfs
|
||||||
|
pushd /etc/dracut.conf.d
|
||||||
|
# Enable VMware PVSCSI support for VMware Fusion guests.
|
||||||
|
echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf
|
||||||
|
echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf
|
||||||
|
# There's no floppy controller, but probing for it generates timeouts
|
||||||
|
echo 'omit_drivers+=" floppy "' > nofloppy.conf
|
||||||
|
popd
|
||||||
|
# Fix the SELinux context of the new files
|
||||||
|
restorecon -f - <<EOF
|
||||||
|
/etc/sudoers.d/vagrant
|
||||||
|
/etc/dracut.conf.d/vmware-fusion-drivers.conf
|
||||||
|
/etc/dracut.conf.d/hyperv-drivers.conf
|
||||||
|
/etc/dracut.conf.d/nofloppy.conf
|
||||||
|
EOF
|
||||||
|
|
||||||
|
virt="$(systemd-detect-virt)"
|
||||||
|
if [ "${virt}" == "microsoft" ]; then
|
||||||
|
systemctl enable hpervfcopyd
|
||||||
|
systemctl enable hypervkvpd
|
||||||
|
systemctl enable hypervvssd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rerun dracut for the installed kernel (not the running kernel):
|
||||||
|
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
|
||||||
|
dracut -f /boot/initramfs-${KERNEL_VERSION}.img ${KERNEL_VERSION}
|
||||||
|
|
||||||
|
# Seal for deployment
|
||||||
|
rm -rf /etc/ssh/ssh_host_*
|
||||||
|
hostnamectl set-hostname localhost.localdomain
|
||||||
|
rm -rf /etc/udev/rules.d/70-*
|
||||||
|
%end
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf clean all
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf install -y qemu-guest-agent
|
||||||
|
systemctl start qemu-guest-agent
|
||||||
|
systemctl enable qemu-guest-agent
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
packages=(gcc make bzip2 kernel-devel elfutils-libelf-devel)
|
||||||
|
dnf install -y "${packages[@]}"
|
||||||
|
mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt
|
||||||
|
/mnt/VBoxLinuxAdditions.run install --nox11 2>&1 | tee /root/vbox_addon_install.log
|
||||||
|
umount /mnt
|
||||||
|
rm /home/vagrant/VBoxGuestAdditions.iso
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf install -y open-vm-tools
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
distro = "rockylinux"
|
||||||
|
version = "9"
|
||||||
|
iso = {
|
||||||
|
url = "http://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.3-x86_64-boot.iso"
|
||||||
|
checksum = "eb096f0518e310f722d5ebd4c69f0322df4fc152c6189f93c5c797dc25f3d2e1"
|
||||||
|
}
|
||||||
|
boot_command = [
|
||||||
|
"<up>e<wait>",
|
||||||
|
"<down><down><end><wait>",
|
||||||
|
" inst.text inst.ks=cdrom:/ks.cfg",
|
||||||
|
"<leftCtrlOn>x<leftCtrlOff>"
|
||||||
|
]
|
||||||
|
cd_files = [ "distros/rockylinux/9/disc/*" ]
|
||||||
|
vbox_os_type = "RedHat9_64"
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
url --mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rocky-BaseOS-$releasever
|
||||||
|
repo --name=AppStream --mirrorlist=http://mirrors.rockylinux.org/mirrorlist?arch=$basearch&repo=rocky-AppStream-$releasever
|
||||||
|
network --bootproto=dhcp --activate
|
||||||
|
reboot
|
||||||
|
|
||||||
|
text
|
||||||
|
keyboard --vckeymap us
|
||||||
|
lang en_US
|
||||||
|
skipx
|
||||||
|
rootpw --plaintext vagrant
|
||||||
|
firewall --disabled
|
||||||
|
timezone --utc UTC
|
||||||
|
services --enabled=vmtoolsd
|
||||||
|
# The biosdevname and ifnames options ensure we get "eth0" as our interface
|
||||||
|
# even in environments like virtualbox that emulate a real NW card
|
||||||
|
bootloader --timeout=1 --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop"
|
||||||
|
clearpart --all
|
||||||
|
autopart --type=plain
|
||||||
|
zerombr
|
||||||
|
|
||||||
|
user --name=vagrant --plaintext --password=vagrant
|
||||||
|
|
||||||
|
%packages --inst-langs=en
|
||||||
|
bash-completion
|
||||||
|
man-pages
|
||||||
|
bzip2
|
||||||
|
rsync
|
||||||
|
nfs-utils
|
||||||
|
cifs-utils
|
||||||
|
chrony
|
||||||
|
yum-utils
|
||||||
|
hyperv-daemons
|
||||||
|
open-vm-tools
|
||||||
|
# Vagrant boxes aren't normally visible, no need for Plymouth
|
||||||
|
-plymouth
|
||||||
|
# Microcode updates cannot work in a VM
|
||||||
|
-microcode_ctl
|
||||||
|
# Firmware packages are not needed in a VM
|
||||||
|
-iwl100-firmware
|
||||||
|
-iwl1000-firmware
|
||||||
|
-iwl105-firmware
|
||||||
|
-iwl135-firmware
|
||||||
|
-iwl2000-firmware
|
||||||
|
-iwl2030-firmware
|
||||||
|
-iwl3160-firmware
|
||||||
|
-iwl3945-firmware
|
||||||
|
-iwl4965-firmware
|
||||||
|
-iwl5000-firmware
|
||||||
|
-iwl5150-firmware
|
||||||
|
-iwl6000-firmware
|
||||||
|
-iwl6000g2a-firmware
|
||||||
|
-iwl6050-firmware
|
||||||
|
-iwl7260-firmware
|
||||||
|
# Don't build rescue initramfs
|
||||||
|
-dracut-config-rescue
|
||||||
|
%end
|
||||||
|
|
||||||
|
# kdump needs to reserve 160MB + 2bits/4kB RAM, and automatic allocation only
|
||||||
|
# works on systems with at least 2GB RAM (which excludes most Vagrant boxes)
|
||||||
|
# CBS doesn't support %addon yet https://bugs.centos.org/view.php?id=12169
|
||||||
|
%addon com_redhat_kdump --disable
|
||||||
|
%end
|
||||||
|
|
||||||
|
%post --erroronfail
|
||||||
|
dnf update -y
|
||||||
|
|
||||||
|
# configure swap to a file
|
||||||
|
fallocate -l 2G /swapfile
|
||||||
|
chmod 600 /swapfile
|
||||||
|
mkswap /swapfile
|
||||||
|
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
|
||||||
|
|
||||||
|
# sudo
|
||||||
|
echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant
|
||||||
|
chmod 0440 /etc/sudoers.d/vagrant
|
||||||
|
|
||||||
|
# Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38
|
||||||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||||||
|
DEVICE="eth0"
|
||||||
|
BOOTPROTO="dhcp"
|
||||||
|
ONBOOT="yes"
|
||||||
|
TYPE="Ethernet"
|
||||||
|
PERSISTENT_DHCLIENT="yes"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# sshd: disable password authentication and DNS checks
|
||||||
|
ex -s /etc/ssh/sshd_config <<EOF
|
||||||
|
:%substitute/^.*\(PasswordAuthentication\) yes$/\1 yes/
|
||||||
|
:%substitute/^#\(UseDNS\) yes$/&\r\1 no/
|
||||||
|
:update
|
||||||
|
:quit
|
||||||
|
EOF
|
||||||
|
cat >>/etc/sysconfig/sshd <<EOF
|
||||||
|
|
||||||
|
echo << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf
|
||||||
|
PubkeyAcceptedKeyTypes +ssh-rsa
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Fix for issue #76, regular users can gain admin privileges via su
|
||||||
|
ex -s /etc/pam.d/su <<'EOF'
|
||||||
|
# allow vagrant to use su, but prevent others from becoming root or vagrant
|
||||||
|
/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/
|
||||||
|
:append
|
||||||
|
account [success=1 default=ignore] \
|
||||||
|
pam_succeed_if.so user = vagrant use_uid quiet
|
||||||
|
account required pam_succeed_if.so user notin root:vagrant
|
||||||
|
.
|
||||||
|
:update
|
||||||
|
:quit
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# systemd should generate a new machine id during the first boot, to
|
||||||
|
# avoid having multiple Vagrant instances with the same id in the local
|
||||||
|
# network. /etc/machine-id should be empty, but it must exist to prevent
|
||||||
|
# boot errors (e.g. systemd-journald failing to start).
|
||||||
|
:>/etc/machine-id
|
||||||
|
|
||||||
|
echo 'vag' > /etc/yum/vars/infra
|
||||||
|
|
||||||
|
# Blacklist the floppy module to avoid probing timeouts
|
||||||
|
echo blacklist floppy > /etc/modprobe.d/nofloppy.conf
|
||||||
|
chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf
|
||||||
|
|
||||||
|
# Customize the initramfs
|
||||||
|
pushd /etc/dracut.conf.d
|
||||||
|
# Enable VMware PVSCSI support for VMware Fusion guests.
|
||||||
|
echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf
|
||||||
|
echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf
|
||||||
|
# There's no floppy controller, but probing for it generates timeouts
|
||||||
|
echo 'omit_drivers+=" floppy "' > nofloppy.conf
|
||||||
|
popd
|
||||||
|
# Fix the SELinux context of the new files
|
||||||
|
restorecon -f - <<EOF
|
||||||
|
/etc/sudoers.d/vagrant
|
||||||
|
/etc/dracut.conf.d/vmware-fusion-drivers.conf
|
||||||
|
/etc/dracut.conf.d/hyperv-drivers.conf
|
||||||
|
/etc/dracut.conf.d/nofloppy.conf
|
||||||
|
EOF
|
||||||
|
|
||||||
|
virt="$(systemd-detect-virt)"
|
||||||
|
if [ "${virt}" == "microsoft" ]; then
|
||||||
|
systemctl enable hpervfcopyd
|
||||||
|
systemctl enable hypervkvpd
|
||||||
|
systemctl enable hypervvssd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Rerun dracut for the installed kernel (not the running kernel):
|
||||||
|
KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
|
||||||
|
dracut -f /boot/initramfs-${KERNEL_VERSION}.img ${KERNEL_VERSION}
|
||||||
|
|
||||||
|
# Seal for deployment
|
||||||
|
rm -rf /etc/ssh/ssh_host_*
|
||||||
|
hostnamectl set-hostname localhost.localdomain
|
||||||
|
rm -rf /etc/udev/rules.d/70-*
|
||||||
|
%end
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf clean all
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf install -y qemu-guest-agent
|
||||||
|
systemctl start qemu-guest-agent
|
||||||
|
systemctl enable qemu-guest-agent
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
packages=(bzip2 kernel-devel kernel-headers make perl gcc)
|
||||||
|
dnf install -y "${packages[@]}"
|
||||||
|
mount -t auto /home/vagrant/VBoxGuestAdditions.iso /mnt
|
||||||
|
/mnt/VBoxLinuxAdditions.run install --nox11 2>&1 | tee /root/vbox_addon_install.log
|
||||||
|
umount /mnt
|
||||||
|
rm /home/vagrant/VBoxGuestAdditions.iso
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
dnf install -y open-vm-tools
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
8: &supp
|
||||||
|
- arch: amd64
|
||||||
|
provider: qemu
|
||||||
|
- arch: amd64
|
||||||
|
provider: virtualbox-iso
|
||||||
|
- arch: amd64
|
||||||
|
provider: vmware-iso
|
||||||
|
- arch: amd64
|
||||||
|
provider: hyperv-iso
|
||||||
|
9: *supp
|
||||||
@@ -17,3 +17,4 @@ boot_command = [
|
|||||||
cd_files = [
|
cd_files = [
|
||||||
"distros/ubuntu/20.04/disc/*"
|
"distros/ubuntu/20.04/disc/*"
|
||||||
]
|
]
|
||||||
|
vbox_os_type = "Ubuntu20_LTS_64"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
distro = "ubuntu"
|
distro = "ubuntu"
|
||||||
version = "22.04"
|
version = "22.04"
|
||||||
iso = {
|
iso = {
|
||||||
url = "https://releases.ubuntu.com/22.04/ubuntu-22.04.3-live-server-amd64.iso"
|
url = "https://releases.ubuntu.com/22.04/ubuntu-22.04.4-live-server-amd64.iso"
|
||||||
checksum = "a4acfda10b18da50e2ec50ccaf860d7f20b389df8765611142305c0e911d16fd"
|
checksum = "45f873de9f8cb637345d6e66a583762730bbea30277ef7b32c9c3bd6700a32b2"
|
||||||
}
|
}
|
||||||
boot_command = [
|
boot_command = [
|
||||||
"e<down><down><down><end><bs><bs><bs>",
|
"e<down><down><down><end><bs><bs><bs>",
|
||||||
@@ -17,3 +17,4 @@ boot_command = [
|
|||||||
cd_files = [
|
cd_files = [
|
||||||
"distros/ubuntu/22.04/disc/*"
|
"distros/ubuntu/22.04/disc/*"
|
||||||
]
|
]
|
||||||
|
vbox_os_type = "Ubuntu22_LTS_64"
|
||||||
|
|||||||
@@ -17,3 +17,4 @@ boot_command = [
|
|||||||
cd_files = [
|
cd_files = [
|
||||||
"distros/ubuntu/23.10/disc/*"
|
"distros/ubuntu/23.10/disc/*"
|
||||||
]
|
]
|
||||||
|
vbox_os_type = "Ubuntu23_64"
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env sh
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Configure vagrant user's SSH key
|
# Configure vagrant user's SSH key
|
||||||
|
|||||||
@@ -2,18 +2,14 @@ packer {
|
|||||||
required_plugins {
|
required_plugins {
|
||||||
qemu = {
|
qemu = {
|
||||||
source = "github.com/hashicorp/qemu"
|
source = "github.com/hashicorp/qemu"
|
||||||
version = "~> 1"
|
version = "= 1.0.10"
|
||||||
}
|
|
||||||
ansible = {
|
|
||||||
source = "github.com/hashicorp/ansible"
|
|
||||||
version = "~> 1"
|
|
||||||
}
|
}
|
||||||
vagrant = {
|
vagrant = {
|
||||||
source = "github.com/hashicorp/vagrant"
|
source = "github.com/hashicorp/vagrant"
|
||||||
version = "= 1.1.1"
|
version = "= 1.1.1"
|
||||||
}
|
}
|
||||||
vmware = {
|
vmware = {
|
||||||
version = ">= 1.0"
|
version = "= 1.0.11"
|
||||||
source = "github.com/hashicorp/vmware"
|
source = "github.com/hashicorp/vmware"
|
||||||
}
|
}
|
||||||
hyperv = {
|
hyperv = {
|
||||||
@@ -22,7 +18,7 @@ packer {
|
|||||||
}
|
}
|
||||||
virtualbox = {
|
virtualbox = {
|
||||||
source = "github.com/hashicorp/virtualbox"
|
source = "github.com/hashicorp/virtualbox"
|
||||||
version = "~> 1"
|
version = "= 1.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ variable "efi_dir" {
|
|||||||
default = env("EFI_DIR")
|
default = env("EFI_DIR")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "vbox_os_type" {
|
||||||
|
type = string
|
||||||
|
default = "Linux_64"
|
||||||
|
}
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
name = "${var.distro}-${var.version}"
|
name = "${var.distro}-${var.version}"
|
||||||
description = templatefile("../README.box.md", {
|
description = templatefile("../README.box.md", {
|
||||||
|
|||||||
@@ -19,13 +19,15 @@ source "virtualbox-iso" "amd64" {
|
|||||||
memory = local.memory
|
memory = local.memory
|
||||||
headless = var.headless
|
headless = var.headless
|
||||||
firmware = "efi"
|
firmware = "efi"
|
||||||
guest_os_type = "Linux_64"
|
guest_os_type = var.vbox_os_type
|
||||||
guest_additions_url = "http://download.virtualbox.org/virtualbox/7.0.10/VBoxGuestAdditions_7.0.10.iso"
|
guest_additions_url = "http://download.virtualbox.org/virtualbox/7.0.10/VBoxGuestAdditions_7.0.10.iso"
|
||||||
guest_additions_sha256 = "bbabd89b8fff38a257bab039a278f0c4dc4426eff6e4238c1db01edb7284186a"
|
guest_additions_sha256 = "bbabd89b8fff38a257bab039a278f0c4dc4426eff6e4238c1db01edb7284186a"
|
||||||
|
nic_type = "virtio"
|
||||||
|
gfx_vram_size = 128
|
||||||
vboxmanage = [
|
vboxmanage = [
|
||||||
["modifyvm", "{{ .Name }}", "--uart1", "0x3F8", "4"],
|
["modifyvm", "{{ .Name }}", "--uart1", "0x3F8", "4"],
|
||||||
#["modifyvm", "{{ .Name }}", "--uartmode1", "file", "output/vritualbox/serial-${var.arch}-${var.distro}-${var.version}"],
|
#["modifyvm", "{{ .Name }}", "--uartmode1", "file", "output/vritualbox/serial-${var.arch}-${var.distro}-${var.version}"],
|
||||||
["modifyvm", "{{ .Name }}", "--nat-localhostreachable1", "on"],
|
["modifyvm", "{{ .Name }}", "--nat-localhostreachable1", "on"]
|
||||||
]
|
]
|
||||||
|
|
||||||
http_content = var.http_files
|
http_content = var.http_files
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ def main():
|
|||||||
with open("Vagrantfile", "w") as fw:
|
with open("Vagrantfile", "w") as fw:
|
||||||
fw.write(content)
|
fw.write(content)
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
vagrant box add @(box) --name @(p.name) --force
|
|
||||||
if str(p.parent.name) in ["virtualbox", "libvirt", "vmware", "hyperv"]:
|
if str(p.parent.name) in ["virtualbox", "libvirt", "vmware", "hyperv"]:
|
||||||
|
vagrant --provider @(p.parent.name) box add @(box) --name @(p.name) --force
|
||||||
vagrant up --provider @(p.parent.name)
|
vagrant up --provider @(p.parent.name)
|
||||||
else:
|
else:
|
||||||
print(f"Now whatcha wanna go and do that for? {box}")
|
print(f"Now whatcha wanna go and do that for? {box}")
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
Vagrant.configure('2') do |c|
|
Vagrant.configure('2') do |c|
|
||||||
|
c.ssh.shell = "/bin/sh"
|
||||||
# Set some basic overrides
|
# Set some basic overrides
|
||||||
c.vm.provider :libvirt do |v, override|
|
c.vm.provider :libvirt do |v, override|
|
||||||
v.driver = 'kvm'
|
v.driver = 'kvm'
|
||||||
|
|||||||
Reference in New Issue
Block a user