From 44399f7478bbb1aa2dea12aeb053ead598f9f2d8 Mon Sep 17 00:00:00 2001 From: Tobias Smolka Date: Fri, 28 Jul 2017 09:20:58 +0200 Subject: [PATCH 1/2] Add Hyper-V provider --- http/hyperv-preseed.cfg | 50 +++++++++++++++++++++++++++++++++++++++++ ubuntu.json | 42 ++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 http/hyperv-preseed.cfg diff --git a/http/hyperv-preseed.cfg b/http/hyperv-preseed.cfg new file mode 100644 index 00000000..cbbd7dc0 --- /dev/null +++ b/http/hyperv-preseed.cfg @@ -0,0 +1,50 @@ +# Ubuntu preseed file - preseed.cfg +# Works for Ubuntu 10.x, 11.x & 12.x +# +# For more information on preseed syntax and commands, refer to: +# https://help.ubuntu.com/12.04/installation-guide/i386/appendix-preseed.html +# +# For testing, you can fire up a local http server temporary. +# Download the preseed.cfg file locally, cd to the directory where the +# preseed.cfg resides and run hte following command: +# $ python -m SimpleHTTPServer +# You don't have to restart the server every time you make changes. Python +# will reload the file from disk every time there is a request. As long as you +# save your changes they will be reflected in the next HTTP download. Then to +# test with a PXE boot server, use the following kernel boot parameters: +# > linux auto url=http://:8000/preseed.cfg hostname= locale=en_US keyboard-configuration/modelcode=SKIP +# +# NOTE: If you netboot/PXE boot Ubuntu, it will ignore the value in hostname, +# but you must provide a hostname as a boot parameter to prevent the Ubuntu +# install from prompting for a hostname + +choose-mirror-bin mirror/http/proxy string +d-i base-installer/kernel/override-image string linux-server +d-i clock-setup/utc boolean true +d-i clock-setup/utc-auto boolean true +d-i finish-install/reboot_in_progress note +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true +d-i partman-auto-lvm/guided_size string max +d-i partman-auto/choose_recipe select atomic +d-i partman-auto/method string lvm +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman/confirm_write_new_label boolean true +d-i user-setup/allow-password-weak boolean true +d-i user-setup/encrypt-home boolean false + +#d-i pkgsel/include string openssh-server cryptsetup build-essential libssl-dev libreadline-dev zlib1g-dev linux-source dkms +d-i pkgsel/include string openssh-server ntp curl nfs-common linux-headers-$(uname -r) build-essential perl dkms linux-tools-$(uname -r) linux-cloud-tools-$(uname -r) +d-i pkgsel/install-language-support boolean false +# Policy for applying updates. May be "none" (no automatic updates), +# "unattended-upgrades" (install security updates automatically), or +# "landscape" (manage system with Landscape). +d-i pkgsel/update-policy select none +d-i pkgsel/upgrade select full-upgrade +d-i time/zone string UTC +tasksel tasksel/first multiselect standard, server diff --git a/ubuntu.json b/ubuntu.json index 160b0961..154a8a0e 100644 --- a/ubuntu.json +++ b/ubuntu.json @@ -143,6 +143,47 @@ "ssh_wait_timeout": "10000s", "type": "parallels-iso", "vm_name": "{{ user `vm_name` }}" + }, + { + "boot_command": [ + "{{ user `boot_command_prefix` }}", + "/install/vmlinuz noapic ", + "file=/floppy/hyperv-{{ user `preseed` }} ", + "debian-installer={{ user `locale` }} auto locale={{ user `locale` }} kbd-chooser/method=us ", + "hostname={{ user `hostname` }} ", + "grub-installer/bootdev=/dev/sda ", + "fb=false debconf/frontend=noninteractive ", + "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", + "keyboard-configuration/variant=USA console-setup/ask_detect=false ", + "passwd/user-fullname={{ user `ssh_fullname` }} ", + "passwd/user-password={{ user `ssh_password` }} ", + "passwd/user-password-again={{ user `ssh_password` }} ", + "passwd/username={{ user `ssh_username` }} ", + "initrd=/install/initrd.gz -- " + ], + "cpu": "{{ user `cpus` }}", + "disk_size": "{{ user `disk_size` }}", + "floppy_files": [ + "http/hyperv-{{ user `preseed` }}" + ], + "generation": 1, + "guest_additions_mode": "disable", + "http_directory": "http", + "iso_checksum": "{{ user `iso_checksum` }}", + "iso_checksum_type": "{{ user `iso_checksum_type` }}", + "iso_urls": [ + "{{ user `iso_path` }}/{{ user `iso_name` }}", + "{{ user `iso_url` }}" + ], + "output_directory": "output-{{ user `vm_name` }}-hyperv-iso", + "ram_size": "{{ user `memory` }}", + "shutdown_command": "echo '{{ user `ssh_password` }}'|sudo -S shutdown -P now", + "ssh_password": "{{ user `ssh_password` }}", + "ssh_username": "{{ user `ssh_username` }}", + "ssh_timeout" : "10000s", + "switch_name": "{{ user `hyperv_switch_name` }}", + "type": "hyperv-iso", + "vm_name": "{{ user `vm_name` }}" } ], "post-processors": [ @@ -194,6 +235,7 @@ "disk_size": "65536", "ftp_proxy": "{{env `ftp_proxy`}}", "headless": "", + "hyperv_switch_name": "", "http_proxy": "{{env `http_proxy`}}", "https_proxy": "{{env `https_proxy`}}", "install_vagrant_key": "true", From de0046762e8f600d9adf90ddbbdd53b66b08679f Mon Sep 17 00:00:00 2001 From: Tobias Date: Tue, 29 Aug 2017 17:09:58 +0000 Subject: [PATCH 2/2] Builder hyperv-iso upgraded to generation 2 --- http/hyperv-preseed.cfg | 3 +++ ubuntu.json | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/http/hyperv-preseed.cfg b/http/hyperv-preseed.cfg index cbbd7dc0..d1a515f5 100644 --- a/http/hyperv-preseed.cfg +++ b/http/hyperv-preseed.cfg @@ -35,6 +35,9 @@ d-i partman/choose_partition select finish d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i partman/confirm_write_new_label boolean true +d-i partman-partitioning/no_bootable_gpt_biosgrub boolean false +d-i partman-partitioning/no_bootable_gpt_efi boolean false +d-i partman-efi/non_efi_system boolean true d-i user-setup/allow-password-weak boolean true d-i user-setup/encrypt-home boolean false diff --git a/ubuntu.json b/ubuntu.json index 154a8a0e..4f6e5963 100644 --- a/ubuntu.json +++ b/ubuntu.json @@ -146,9 +146,9 @@ }, { "boot_command": [ - "{{ user `boot_command_prefix` }}", - "/install/vmlinuz noapic ", - "file=/floppy/hyperv-{{ user `preseed` }} ", + "", + "linux /install/vmlinuz ", + "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/hyperv-{{ user `preseed` }} ", "debian-installer={{ user `locale` }} auto locale={{ user `locale` }} kbd-chooser/method=us ", "hostname={{ user `hostname` }} ", "grub-installer/bootdev=/dev/sda ", @@ -159,14 +159,14 @@ "passwd/user-password={{ user `ssh_password` }} ", "passwd/user-password-again={{ user `ssh_password` }} ", "passwd/username={{ user `ssh_username` }} ", - "initrd=/install/initrd.gz -- " + "", + "initrd /install/initrd.gz", + "boot" ], "cpu": "{{ user `cpus` }}", "disk_size": "{{ user `disk_size` }}", - "floppy_files": [ - "http/hyperv-{{ user `preseed` }}" - ], - "generation": 1, + "enable_secure_boot": false, + "generation": 2, "guest_additions_mode": "disable", "http_directory": "http", "iso_checksum": "{{ user `iso_checksum` }}",