Begin adding VMWare

This commit is contained in:
Greg Hellings
2023-08-15 11:23:29 -05:00
committed by greg-compass
parent 15044c8fb9
commit a56b40249b
17 changed files with 35 additions and 27 deletions
+6 -6
View File
@@ -14,12 +14,12 @@
- name: modern systems - name: modern systems
ansible.builtin.import_tasks: has_package.yml ansible.builtin.import_tasks: has_package.yml
when: >- when: >-
ansible_distribution_name == 'fedora' or ansible_facts.distribution == 'fedora' or
(ansible_distribution_name == 'debian' and (ansible_facts.distribution == 'debian' and
ansible_distribution_major_version > '8') ansible_facts.distribution_major_version > 8)
- name: legacy builds - name: legacy builds
ansible.builtin.import_tasks: legacy.yml ansible.builtin.import_tasks: legacy.yml
when: >- when:
(ansible_distribution_name == 'debian' and - ansible_facts.distribution == 'debian'
ansible_distribution_major_version <= '8') - ansible_facts.distribution_major_version <= '8'
-2
View File
@@ -1,2 +0,0 @@
vmware_packages:
- open-vm-tools
-2
View File
@@ -1,2 +0,0 @@
vmware_packages:
- open-vm-tools
-2
View File
@@ -1,2 +0,0 @@
vmware_packages:
- open-vm-tools
+2 -1
View File
@@ -3,6 +3,7 @@
set -ex set -ex
port="${1}" # HTTP port that packer is running on port="${1}" # HTTP port that packer is running on
host="${2}"
loadkeys en # Probably not necessary in a script, but here we are loadkeys en # Probably not necessary in a script, but here we are
@@ -40,7 +41,7 @@ pacstrap -K /mnt base linux nano sudo networkmanager openssh grub python3
genfstab -L /mnt >> /mnt/etc/fstab genfstab -L /mnt >> /mnt/etc/fstab
# Run stuff in the chroot # Run stuff in the chroot
curl -o /mnt/in-chroot.sh http://10.0.2.2:"${port}"/in-chroot.sh curl -o /mnt/in-chroot.sh "http://${host}:${port}/in-chroot.sh"
arch-chroot /mnt /usr/bin/bash /in-chroot.sh "${disk}" arch-chroot /mnt /usr/bin/bash /in-chroot.sh "${disk}"
rm /mnt/in-chroot.sh rm /mnt/in-chroot.sh
+1 -1
View File
@@ -9,7 +9,7 @@ boot_command = [
"<wait60>", # Wait for system to come up? "<wait60>", # Wait for system to come up?
"curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>", "curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait5>", "<wait5>",
"/usr/bin/bash /tmp/install.sh {{ .HTTPPort }}<enter>" "/usr/bin/bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}<enter>"
] ]
http_directory = "distros/archlinux/rolling/http/" http_directory = "distros/archlinux/rolling/http/"
boot_wait = "10s" boot_wait = "10s"
+2
View File
@@ -3,3 +3,5 @@ rolling:
provider: qemu provider: qemu
- arch: x86_64 - arch: x86_64
provider: virtualbox-iso provider: virtualbox-iso
- arch: x86_64
provider: vmware-iso
+3 -5
View File
@@ -1,10 +1,8 @@
8: 8: &supp
- arch: x86_64 - arch: x86_64
provider: qemu provider: qemu
- arch: x86_64 - arch: x86_64
provider: virtualbox-iso provider: virtualbox-iso
9:
- arch: x86_64 - arch: x86_64
provider: qemu provider: vmware-iso
- arch: x86_64 9: *supp
provider: virtualbox-iso
+2
View File
@@ -3,3 +3,5 @@
provider: qemu provider: qemu
- arch: x86_64 - arch: x86_64
provider: virtualbox-iso provider: virtualbox-iso
- arch: x86_64
provider: vmware-iso
+2
View File
@@ -3,6 +3,8 @@
provider: qemu provider: qemu
- arch: x86_64 - arch: x86_64
provider: virtualbox-iso provider: virtualbox-iso
- arch: x86_64
provider: vmware-iso
11: *supp 11: *supp
12: *supp 12: *supp
#9: *supp # EOL #9: *supp # EOL
+2
View File
@@ -3,5 +3,7 @@
provider: qemu provider: qemu
- arch: x86_64 - arch: x86_64
provider: virtualbox-iso provider: virtualbox-iso
- arch: x86_64
provider: vmware-iso
38: *supp 38: *supp
rawhide: [] rawhide: []
+3 -2
View File
@@ -3,6 +3,7 @@
set -ex set -ex
port="${1}" # HTTP port that packer is running on port="${1}" # HTTP port that packer is running on
host="${2}"
if [ -e /dev/vda ]; then if [ -e /dev/vda ]; then
disk="/dev/vda" disk="/dev/vda"
@@ -34,13 +35,13 @@ mount "${disk}1" /mnt
# Bootstrap system # Bootstrap system
nixos-generate-config --root /mnt nixos-generate-config --root /mnt
curl -o /mnt/etc/nixos/configuration.nix http://10.0.2.2:"${port}"/configuration.nix curl -o /mnt/etc/nixos/configuration.nix "http://${host}:${port}/configuration.nix"
sed -i -E -e "s,@BOOT_DEVICE@,${disk}," /mnt/etc/nixos/configuration.nix sed -i -E -e "s,@BOOT_DEVICE@,${disk}," /mnt/etc/nixos/configuration.nix
sed -i -E -e 's,(.*device = "/dev/disk/).*(".*),\1by-label/root\2,' /mnt/etc/nixos/hardware-configuration.nix sed -i -E -e 's,(.*device = "/dev/disk/).*(".*),\1by-label/root\2,' /mnt/etc/nixos/hardware-configuration.nix
nixos-install --no-root-password nixos-install --no-root-password
# Run stuff in the chroot # Run stuff in the chroot
curl -o /mnt/root/in-chroot.sh http://10.0.2.2:"${port}"/in-chroot.sh curl -o /mnt/root/in-chroot.sh "http://${host}:${port}/in-chroot.sh"
nixos-enter --root /mnt -c 'bash /root/in-chroot.sh' nixos-enter --root /mnt -c 'bash /root/in-chroot.sh'
rm /mnt/root/in-chroot.sh rm /mnt/root/in-chroot.sh
+2 -2
View File
@@ -2,14 +2,14 @@ distro = "nixos"
version = "23.05" version = "23.05"
iso = { iso = {
url = "https://channels.nixos.org/nixos-23.05/latest-nixos-minimal-x86_64-linux.iso" url = "https://channels.nixos.org/nixos-23.05/latest-nixos-minimal-x86_64-linux.iso"
checksum = "f5df994324bc474e834200c8d641ba32492474112e95b63df3153a906ad0bca8" checksum = "e2a0bc2be3b6638692393a19435838d464149914dbd942010e31a3c8c84c82d5"
} }
boot_command = [ boot_command = [
"<tab><wait> net.ifnames=0<wait> <wait>bi<wait>osdevnames=0<enter>", "<tab><wait> net.ifnames=0<wait> <wait>bi<wait>osdevnames=0<enter>",
"<wait60>", # Wait for system to come up? "<wait60>", # Wait for system to come up?
"curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>", "curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait>", "<wait>",
"sudo bash /tmp/install.sh {{ .HTTPPort }}<enter>" "sudo bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}<enter>"
] ]
http_directory = "distros/nixos/23.05/http/" http_directory = "distros/nixos/23.05/http/"
boot_wait = "5s" boot_wait = "5s"
+2
View File
@@ -3,5 +3,7 @@
provider: qemu provider: qemu
- arch: x86_64 - arch: x86_64
provider: virtualbox-iso provider: virtualbox-iso
- arch: x86_64
provider: vmware-iso
22.04: *supp 22.04: *supp
#18.04: *supp # EOL #18.04: *supp # EOL
+1 -1
View File
@@ -18,7 +18,7 @@ source "vmware-iso" "x86_64" {
cpus = local.cpus cpus = local.cpus
memory = local.memory memory = local.memory
headless = var.headless headless = var.headless
guest_os_type = "Linux_64" #guest_os_type = "Linux_64"
http_content = var.http_files http_content = var.http_files
http_directory = var.http_directory http_directory = var.http_directory
+7 -3
View File
@@ -13,13 +13,16 @@ def get_vagrant_provider(provider):
return "libvirt" return "libvirt"
elif provider.startswith("virtualbox"): elif provider.startswith("virtualbox"):
return "virtualbox" return "virtualbox"
elif provider.startswith("vmware"):
return "vmware"
def get_providers(): def get_providers():
"List of providers as defined in sources/" "List of providers as defined in sources/"
providers: set[str] = { providers: set[str] = {
"virtualbox-iso.x86_64",
"qemu.x86_64" "qemu.x86_64"
"virtualbox-iso.x86_64",
"vmware-iso.x86_64"
} }
return providers return providers
@@ -54,8 +57,9 @@ def main():
for box in g`output/**/*.box`: for box in g`output/**/*.box`:
p = pathlib.Path(box) p = pathlib.Path(box)
sed -e f's#@@BOX@@#file:///home/greg/src/vms/vms/{box}#' -e f's/@@BOX_NAME@@/{p.name}/' Vagrantfile.in > Vagrantfile sed -e f's#@@BOX@@#file:///home/greg/src/vms/vms/{box}#' -e f's/@@BOX_NAME@@/{p.name}/' Vagrantfile.in > Vagrantfile
if str(p.parent.name) in ["virtualbox", "libvirt"]: vagrant box add @(box) --name @(p.name)
vagrant up --provider @(p.parent.name) if str(p.parent.name) in ["virtualbox", "libvirt", "vmware"]:
vagrant up --provider vmware_fusion
else: else:
print(f"Now whatcha wanna go and do that for? {box}") print(f"Now whatcha wanna go and do that for? {box}")
continue continue