Merge "Switch VCP to LVM based partitions"
diff --git a/common/ubuntu_security.sh b/common/ubuntu_security.sh
index f2641c3..03bb54b 100644
--- a/common/ubuntu_security.sh
+++ b/common/ubuntu_security.sh
@@ -42,7 +42,7 @@
usermod -p '!' root
# Drop default 'ubuntu' user
-userdel -rf ubuntu
+userdel -rf ubuntu || true
# Disable SSH password authentication and permit root login
sed -i 's|[#]*PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config
diff --git a/ubuntu-16.04/http/preseed.cfg b/ubuntu-16.04/http/preseed.cfg
index 269a2bc..8eaf33e 100644
--- a/ubuntu-16.04/http/preseed.cfg
+++ b/ubuntu-16.04/http/preseed.cfg
@@ -17,23 +17,126 @@
d-i netcfg/get_hostname string unassigned-hostname
d-i partman-auto/disk string /dev/sda /dev/vda
-d-i partman-auto/method string regular
-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-basicfilesystems/no_swap boolean false
-d-i partman-auto/choose_recipe select boot-root
+# Use LVM for partitioning
+d-i partman-auto/method string lvm
-d-i partman-auto/expert_recipe string \
- boot-root :: \
- 512 512 -1 ext4 \
- $primary{ } $bootable{ } \
- method{ format } format{ } \
- use_filesystem{ } filesystem{ ext4 } \
- mountpoint{ / } \
- options/noatime{ noatime } \
- . \
+# GPT
+
+d-i partman-basicfilesystems/choose_label string gpt
+d-i partman-basicfilesystems/default_label string gpt
+d-i partman-partitioning/choose_label string gpt
+d-i partman-partitioning/default_label string gpt
+d-i partman/choose_label string gpt
+d-i partman/default_label string gpt
+
+# GPT
+
+d-i partman-auto-lvm/guided_size string max
+
+# If one of the disks that are going to be automatically partitioned
+# contains an old LVM configuration, the user will normally receive a
+# warning. Preseed this away
+d-i partman-lvm/device_remove_lvm boolean true
+
+# And the same goes for the confirmation to write the lvm partitions.
+d-i partman-lvm/confirm boolean true
+
+# Really, please don't prompt me!
+d-i partman-lvm/confirm_nooverwrite boolean true
+
+d-i partman-auto/expert_recipe string \
+ vcp_lvm :: \
+ 1 1 1 free \
+ $gptonly{ } \
+ $primary{ } \
+ $bios_boot{ } \
+ method{ biosgrub } \
+ . \
+ 1051 2 1051 ext3 \
+ $gptonly{ } \
+ $primary{ } \
+ method{ format } format{ } \
+ use_filesystem{ } filesystem{ ext3 } \
+ lable{ lable-boot } \
+ mountpoint{ /boot } \
+ . \
+ 10 10 10 ext4 \
+ $defaultignore{ } \
+ $gptonly{ } \
+ $primary{ } \
+ method{ lvm } \
+ vg_name{ vg0 } \
+ . \
+ 105 2 105 ext4 \
+ $lvmok{ } \
+ in_vg{ vg0 } \
+ lv_name{ home } \
+ method{ lvm } format{ } \
+ use_filesystem{ } filesystem{ ext4 } \
+ mountpoint{ /home } \
+ options/nodev{ nodev } \
+ . \
+ 105 2 105 ext4 ext4 \
+ $lvmok{ } \
+ in_vg{ vg0 } \
+ lv_name{ tmp } \
+ method{ lvm } format{ } \
+ use_filesystem{ } filesystem{ ext4 } \
+ mountpoint{ /tmp } \
+ options/nodev{ nodev } \
+ options/nosuid{ nosuid } \
+ options/noexec{ noexec } \
+ . \
+ 105 2 105 ext4 \
+ $lvmok{ } \
+ in_vg{ vg0 } \
+ lv_name{ var_log } \
+ method{ format } format{ } \
+ use_filesystem{ } filesystem{ ext4 } \
+ mountpoint{ /var/log } \
+ options/noexec{ noexec } \
+ . \
+ 315 2 315 ext4 ext4 \
+ $lvmok{ } \
+ in_vg{ vg0 } \
+ lv_name{ var_tmp } \
+ method{ format } format{ } \
+ use_filesystem{ } filesystem{ ext4 } \
+ mountpoint{ /var/tmp } \
+ options/nodev{ nodev } \
+ options/nosuid{ nosuid } \
+ options/noexec{ noexec } \
+ . \
+ 105 2 105 ext4 ext4 \
+ $lvmok{ } \
+ in_vg{ vg0 } \
+ lv_name{ var_log_audit } \
+ method{ format } format{ } \
+ use_filesystem{ } filesystem{ ext4 } \
+ mountpoint{ /var/log/audit } \
+ options/noexec{ noexec } \
+ . \
+ 2154 2 65536 ext4 \
+ $lvmok{ } \
+ method{ format } format{ } \
+ use_filesystem{ } filesystem{ ext4 } \
+ mountpoint{ / } \
+ in_vg{ vg0 } \
+ lv_name{ root } \
+ .
+
+d-i partman-auto/choose_recipe select vcp_lvm
+
+partman-basicfilesystems partman-basicfilesystems/no_swap boolean false
+
+# This makes partman automatically partition without confirmation, provided
+# that you told it what to do using one of the methods above.
+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 pkgsel/include string openssh-server
d-i pkgsel/install-language-support boolean false
diff --git a/ubuntu-16.04/template.json b/ubuntu-16.04/template.json
index 1cfc211..10f84df 100644
--- a/ubuntu-16.04/template.json
+++ b/ubuntu-16.04/template.json
@@ -2,7 +2,7 @@
"variables": {
"user": "root",
"password": "ho5uo7Uome5d",
- "disk_size": "8000",
+ "disk_size": "5000",
"images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
"ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
"saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
@@ -270,35 +270,37 @@
{
"type": "qemu",
"qemuargs": [
- [ "-m", "1024M" ],
- [ "-cdrom", "config-drive/cloudata.iso" ],
+ ["-m", "1024M"],
["-device", "virtio-net,netdev=user.0"],
["-object","rng-random,id=objrng0,filename=/dev/urandom"],
- ["-device", "virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x10" ]
+ ["-device", "virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.0,addr=0x10"]
],
- "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
- "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}",
- "format": "qcow2",
- "iso_checksum": "c71d27a86a168f28097bc30004b54c1f",
- "iso_checksum_type": "md5",
- "iso_url": "http://releases.ubuntu.com/16.04.5/ubuntu-16.04.5-server-amd64.iso",
- "iso_target_path": "{{ user `images_cache`}}/ubuntu-16.04.5-server-amd64.iso",
- "disk_image": true,
- "disk_compression": true,
+ "vm_name": "{{ user `image_name` }}",
+ "output_directory": "images/{{ user `image_name`}}",
"accelerator": "kvm",
"disk_size": "{{ user `disk_size`}}",
+ "iso_checksum": "24636fd103a2a43c95659f1c3c63718e",
+ "iso_checksum_type": "md5",
+ "iso_url": "http://releases.ubuntu.com/16.04.5/ubuntu-16.04.5-server-amd64.iso",
+ "iso_target_path": "{{ user `images_cache` }}/ubuntu-16.04.5-server-amd64.iso",
+ "http_directory": "http",
"headless": true,
- "ssh_username": "{{ user `user` }}",
- "ssh_password": "{{ user `password` }}",
- "ssh_host_port_min": 7000,
- "ssh_host_port_max": 7050,
- "shutdown_command": "shutdown -P now",
+ "ssh_username": "{{user `user`}}",
+ "ssh_password": "{{user `password`}}",
+ "shutdown_command": "sync; sudo /sbin/shutdown -hP now",
"boot_wait": "2s",
- "ssh_wait_timeout": "360s",
+ "ssh_wait_timeout": "700s",
"boot_command": [
- "<wait50ms>",
- "<esc><wait>",
- "<enter><wait>",
+ "<enter><wait><f6><esc>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
+ "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
"/install/vmlinuz<wait>",
" auto<wait>",
" console-setup/ask_detect=false<wait>",