diff --git a/ansible/roles/virtualbox/tasks/main.yml b/ansible/roles/virtualbox/tasks/main.yml index 8d3ff09..ac64d55 100644 --- a/ansible/roles/virtualbox/tasks/main.yml +++ b/ansible/roles/virtualbox/tasks/main.yml @@ -54,3 +54,8 @@ ansible.builtin.package: name: "{{ virtualbox_remove_packages | default([]) }}" state: absent + +- name: Remove file + ansible.builtin.file: + path: "{{ virtualbox_iso_location }}" + state: absent diff --git a/ansible/roles/virtualbox/vars/Debian.yml b/ansible/roles/virtualbox/vars/Debian.yml new file mode 100644 index 0000000..21b1efa --- /dev/null +++ b/ansible/roles/virtualbox/vars/Debian.yml @@ -0,0 +1,5 @@ +virtualbox_packages: + - linux-image-amd64 +virtualbox_services: [] +virtualbox_from_iso: false +virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso" diff --git a/ansible/roles/virtualbox/vars/Debian_10.yml b/ansible/roles/virtualbox/vars/Debian_10.yml new file mode 100644 index 0000000..96ef151 --- /dev/null +++ b/ansible/roles/virtualbox/vars/Debian_10.yml @@ -0,0 +1,8 @@ +virtualbox_packages: + - dkms + - bzip2 + - linux-headers-amd64 + - make +virtualbox_services: [] +virtualbox_from_iso: true +virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso" diff --git a/ansible/roles/virtualbox/vars/Debian_9.yml b/ansible/roles/virtualbox/vars/Debian_9.yml new file mode 100644 index 0000000..96ef151 --- /dev/null +++ b/ansible/roles/virtualbox/vars/Debian_9.yml @@ -0,0 +1,8 @@ +virtualbox_packages: + - dkms + - bzip2 + - linux-headers-amd64 + - make +virtualbox_services: [] +virtualbox_from_iso: true +virtualbox_iso_location: "{{ ansible_user_dir }}/VBoxGuestAdditions.iso" diff --git a/distros/debian-10-x86_64.pkrvars.hcl b/distros/debian-10-x86_64.pkrvars.hcl new file mode 100644 index 0000000..2eedaef --- /dev/null +++ b/distros/debian-10-x86_64.pkrvars.hcl @@ -0,0 +1,16 @@ +distro = "debian" +version = "10" +iso = { + url = "https://cdimage.debian.org/cdimage/archive/10.11.0/amd64/iso-cd/debian-10.11.0-amd64-netinst.iso" + checksum = "133430141272d8bf96cfb10b6bfd1c945f5a59ea0efc2bcb56d1033c7f2866ea" +} +boot_command = [ + "", + "auto ", + "DEBIAN_FRONTEND=text ", + "net.ifnames=0 ", + "biosdevnames=0 ", + "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/debian/10-preseed.cfg ", + "console=ttyS0 ", + "" +] diff --git a/distros/debian-11-x86_64.pkrvars.hcl b/distros/debian-11-x86_64.pkrvars.hcl new file mode 100644 index 0000000..25c86db --- /dev/null +++ b/distros/debian-11-x86_64.pkrvars.hcl @@ -0,0 +1,16 @@ +distro = "debian" +version = "11" +iso = { + url = "https://cdimage.debian.org/cdimage/archive/11.2.0/amd64/iso-cd/debian-11.2.0-amd64-netinst.iso" + checksum = "45c9feabba213bdc6d72e7469de71ea5aeff73faea6bfb109ab5bad37c3b43bd" +} +boot_command = [ + "", + "auto ", + "DEBIAN_FRONTEND=text ", + "net.ifnames=0 ", + "biosdevnames=0 ", + "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/debian/11-preseed.cfg ", + "console=ttyS0 ", + "" +] diff --git a/distros/debian-9-x86_64.pkrvars.hcl b/distros/debian-9-x86_64.pkrvars.hcl new file mode 100644 index 0000000..290c717 --- /dev/null +++ b/distros/debian-9-x86_64.pkrvars.hcl @@ -0,0 +1,16 @@ +distro = "debian" +version = "9" +iso = { + url = "https://cdimage.debian.org/cdimage/archive/9.13.0/amd64/iso-cd/debian-9.13.0-amd64-netinst.iso" + checksum = "71c7e9eb292acc880f84605b1ca2b997f25737fe0a43fc9586f61d35cd2eb43b" +} +boot_command = [ + "", + "auto ", + "DEBIAN_FRONTEND=text ", + "net.ifnames=0 ", + "biosdevnames=0 ", + "preseed/url=http://{{.HTTPIP}}:{{ .HTTPPort }}/debian/9-preseed.cfg ", + "console=ttyS0 ", + "" +] diff --git a/distros/ubuntu-18.04-x86_64.pkrvars.hcl b/distros/ubuntu-18.04-x86_64.pkrvars.hcl index c4694a9..fca66bc 100644 --- a/distros/ubuntu-18.04-x86_64.pkrvars.hcl +++ b/distros/ubuntu-18.04-x86_64.pkrvars.hcl @@ -10,7 +10,8 @@ boot_command = [ "", "", "auto=true priority=critical ", - "DEBIAN_FRONTEND=noninteractive ", + "locale=en_US.UTF-8 ", + "DEBIAN_FRONTEND=text ", "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/ubuntu/18.04/preseed.cfg ", "fsck.mode=skip ", "console=ttyS0 ", diff --git a/http/ubuntu/preseed.cfg b/http/debian/10-preseed.cfg similarity index 64% rename from http/ubuntu/preseed.cfg rename to http/debian/10-preseed.cfg index e7945b7..8878035 100644 --- a/http/ubuntu/preseed.cfg +++ b/http/debian/10-preseed.cfg @@ -1,12 +1,14 @@ d-i debian-installer/locale string en_US -d-i time/zone string UTC - d-i keyboard-configuration/xkb-keymap select us -d-i clock-setup/utc boolean true -d-i clock-setup/utc-auto boolean true +d-i passwd/root-password-again password vagrant +d-i passwd/root-password password vagrant +d-i passwd/user-fullname string vagrant +d-i passwd/username string vagrant +d-i passwd/user-password password vagrant +d-i passwd/user-password-again password vagrant -d-i debian-installer/missing-provide select ${DEFAULT} +d-i time/zone string UTC d-i partman-auto/method string regular d-i partman-auto/expert_recipe string \ @@ -35,26 +37,22 @@ d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true -d-i base-installer/excludes string laptop-detect +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true -d-i passwd/root-password-again password vagrant -d-i passwd/root-password password vagrant -d-i passwd/user-fullname string vagrant -d-i passwd/username string vagrant -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant -d-i user-setup/allow-password-weak boolean true +tasksel tasksel/first multiselect +d-i pkgsel/include string curl openssh-server sudo python3 -d-i pkgsel/include string curl openssh-server sudo -d-i pkgsel/language-packs multiselect -d-i pkgsel/upgrade select full-upgrade -d-i pkgsel/update-policy select none -tasksel tasksel/first multiselect ubuntu-server +d-i grub-installer/bootdev string default d-i finish-install/reboot_in_progress note -d-i preseed/late_command string \ +d-i preseed/early_command string \ + sed -i \ + -e "/in-target/i echo 'd() { /sbin/discover \"\$@\" | grep -v virtualbox; }' > /target/etc/discover-pkginstall.conf" \ + -e "/in-target/i echo 'discover=d' >> /target/etc/discover-pkginstall.conf" \ + /usr/lib/pre-pkgsel.d/20install-hwpackages +d-i preseed/late_command string \ echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant; \ echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \ - chmod 440 /target/etc/sudoers.d/vagrant; \ - in-target update-initramfs -u + chmod 440 /target/etc/sudoers.d/vagrant diff --git a/http/debian/11-preseed.cfg b/http/debian/11-preseed.cfg new file mode 100644 index 0000000..8878035 --- /dev/null +++ b/http/debian/11-preseed.cfg @@ -0,0 +1,58 @@ +d-i debian-installer/locale string en_US +d-i keyboard-configuration/xkb-keymap select us + +d-i passwd/root-password-again password vagrant +d-i passwd/root-password password vagrant +d-i passwd/user-fullname string vagrant +d-i passwd/username string vagrant +d-i passwd/user-password password vagrant +d-i passwd/user-password-again password vagrant + +d-i time/zone string UTC + +d-i partman-auto/method string regular +d-i partman-auto/expert_recipe string \ + scheme :: \ + 200 0 200 ext4 \ + $primary{ } \ + $bootable{ } \ + method{ format } \ + format{ } \ + use_filesystem{ } \ + filesystem{ ext4 } \ + mountpoint{ /boot } . \ + 200% 0 200% linux-swap \ + $primary{ } \ + method{ swap } \ + format{ } . \ + 1 0 -1 ext4 \ + $primary{ } \ + method{ format } \ + format{ } \ + use_filesystem{ } \ + filesystem{ ext4 } \ + mountpoint{ / } . +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true + +tasksel tasksel/first multiselect +d-i pkgsel/include string curl openssh-server sudo python3 + +d-i grub-installer/bootdev string default + +d-i finish-install/reboot_in_progress note + +d-i preseed/early_command string \ + sed -i \ + -e "/in-target/i echo 'd() { /sbin/discover \"\$@\" | grep -v virtualbox; }' > /target/etc/discover-pkginstall.conf" \ + -e "/in-target/i echo 'discover=d' >> /target/etc/discover-pkginstall.conf" \ + /usr/lib/pre-pkgsel.d/20install-hwpackages +d-i preseed/late_command string \ + echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant; \ + echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \ + chmod 440 /target/etc/sudoers.d/vagrant diff --git a/http/debian/9-preseed.cfg b/http/debian/9-preseed.cfg new file mode 100644 index 0000000..8878035 --- /dev/null +++ b/http/debian/9-preseed.cfg @@ -0,0 +1,58 @@ +d-i debian-installer/locale string en_US +d-i keyboard-configuration/xkb-keymap select us + +d-i passwd/root-password-again password vagrant +d-i passwd/root-password password vagrant +d-i passwd/user-fullname string vagrant +d-i passwd/username string vagrant +d-i passwd/user-password password vagrant +d-i passwd/user-password-again password vagrant + +d-i time/zone string UTC + +d-i partman-auto/method string regular +d-i partman-auto/expert_recipe string \ + scheme :: \ + 200 0 200 ext4 \ + $primary{ } \ + $bootable{ } \ + method{ format } \ + format{ } \ + use_filesystem{ } \ + filesystem{ ext4 } \ + mountpoint{ /boot } . \ + 200% 0 200% linux-swap \ + $primary{ } \ + method{ swap } \ + format{ } . \ + 1 0 -1 ext4 \ + $primary{ } \ + method{ format } \ + format{ } \ + use_filesystem{ } \ + filesystem{ ext4 } \ + mountpoint{ / } . +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +d-i apt-setup/non-free boolean true +d-i apt-setup/contrib boolean true + +tasksel tasksel/first multiselect +d-i pkgsel/include string curl openssh-server sudo python3 + +d-i grub-installer/bootdev string default + +d-i finish-install/reboot_in_progress note + +d-i preseed/early_command string \ + sed -i \ + -e "/in-target/i echo 'd() { /sbin/discover \"\$@\" | grep -v virtualbox; }' > /target/etc/discover-pkginstall.conf" \ + -e "/in-target/i echo 'discover=d' >> /target/etc/discover-pkginstall.conf" \ + /usr/lib/pre-pkgsel.d/20install-hwpackages +d-i preseed/late_command string \ + echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant; \ + echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \ + chmod 440 /target/etc/sudoers.d/vagrant diff --git a/http/ubuntu/18.04/preseed.cfg b/http/ubuntu/18.04/preseed.cfg index 3d1f861..d98614e 100644 --- a/http/ubuntu/18.04/preseed.cfg +++ b/http/ubuntu/18.04/preseed.cfg @@ -1,9 +1,6 @@ -d-i debian-installer/locale string en_US.UTF-8 -d-i debian-installer/language string en -d-i debian-installer/country string US +d-i debian-installer/locale string C.UTF-8 +d-i keyboard-configuration/xkb-keymap select us -d-i preseed/include string /preseed/ubuntu-server-minimalvm.seed -d-i preseed/include string ../preseed.cfg d-i console-setup/ask_detect boolean false @@ -11,9 +8,68 @@ d-i keyboard-configuration/model select USA d-i keyboard-configuration/layout select USA d-i keyboard-configuration/variant select USA +d-i preseed/early_command string ln -s /dev/sda /dev/vda || : d-i grub-installer/bootdev string /dev/vda d-i netcfg/choose_interface select auto d-i mirror/http/mirror select us.archive.ubuntu.com d-i mirror/http/proxy string + +d-i time/zone string UTC + +d-i clock-setup/utc boolean true +d-i clock-setup/utc-auto boolean true + +d-i debian-installer/missing-provide select ${DEFAULT} + +d-i partman-auto/method string regular +d-i partman-auto/expert_recipe string \ + scheme :: \ + 200 0 200 ext4 \ + $primary{ } \ + $bootable{ } \ + method{ format } \ + format{ } \ + use_filesystem{ } \ + filesystem{ ext4 } \ + mountpoint{ /boot } . \ + 200% 0 200% linux-swap \ + $primary{ } \ + method{ swap } \ + format{ } . \ + 1 0 -1 ext4 \ + $primary{ } \ + method{ format } \ + format{ } \ + use_filesystem{ } \ + filesystem{ ext4 } \ + mountpoint{ / } . +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +d-i base-installer/excludes string laptop-detect + +d-i passwd/root-password-again password vagrant +d-i passwd/root-password password vagrant +d-i passwd/user-fullname string vagrant +d-i passwd/username string vagrant +d-i passwd/user-password password vagrant +d-i passwd/user-password-again password vagrant +d-i user-setup/allow-password-weak boolean true + +d-i pkgsel/include string curl openssh-server sudo +d-i pkgsel/language-packs multiselect +d-i pkgsel/upgrade select full-upgrade +d-i pkgsel/update-policy select none +tasksel tasksel/first multiselect ubuntu-server + +d-i finish-install/reboot_in_progress note + +d-i preseed/late_command string \ + echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant; \ + echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /target/etc/sudoers.d/vagrant; \ + chmod 440 /target/etc/sudoers.d/vagrant; \ + in-target update-initramfs -u