Switch ubuntu16 image to iso installation type
* Implement LVM partitioning
Change-Id: I8bfeff1d0be0debd41eea62ab299a1e4697f515b
diff --git a/ubuntu-16.04/http/preseed.cfg b/ubuntu-16.04/http/preseed.cfg
new file mode 100644
index 0000000..269a2bc
--- /dev/null
+++ b/ubuntu-16.04/http/preseed.cfg
@@ -0,0 +1,54 @@
+choose-mirror-bin mirror/http/proxy string
+d-i debian-installer/locale string en_US
+d-i debian-installer/language string en
+d-i debian-installer/country EN
+
+d-i pkgsel/install-language-support boolean false
+
+d-i debian-installer/framebuffer boolean false
+d-i debconf/frontend select noninteractive
+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 netcfg/get_domain string unassigned-domain
+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
+
+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 } \
+ . \
+
+d-i pkgsel/include string openssh-server
+d-i pkgsel/install-language-support boolean false
+d-i pkgsel/update-policy select none
+popularity-contest popularity-contest/participate boolean false
+
+d-i pkgsel/upgrade select none
+
+d-i time/zone string UTC
+d-i passwd/root-login boolean true
+d-i passwd/make-user boolean false
+d-i openssh-server/permit-root-login boolean true
+d-i user-setup/allow-password-weak boolean true
+d-i user-setup/encrypt-home boolean false
+tasksel tasksel/first multiselect minimal, ssh-server, openssh-server
+
+d-i preseed/late_command string \
+ in-target sed -i 's/PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
diff --git a/ubuntu-16.04/template.json b/ubuntu-16.04/template.json
index ef20aaa..1cfc211 100644
--- a/ubuntu-16.04/template.json
+++ b/ubuntu-16.04/template.json
@@ -279,10 +279,10 @@
"vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
"output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}",
"format": "qcow2",
- "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642",
+ "iso_checksum": "c71d27a86a168f28097bc30004b54c1f",
"iso_checksum_type": "md5",
- "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
- "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img",
+ "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,
"accelerator": "kvm",
@@ -294,7 +294,33 @@
"ssh_host_port_max": 7050,
"shutdown_command": "shutdown -P now",
"boot_wait": "2s",
- "ssh_wait_timeout": "360s"
+ "ssh_wait_timeout": "360s",
+ "boot_command": [
+ "<wait50ms>",
+ "<esc><wait>",
+ "<enter><wait>",
+ "/install/vmlinuz<wait>",
+ " auto<wait>",
+ " console-setup/ask_detect=false<wait>",
+ " console-setup/layoutcode=us<wait>",
+ " console-setup/modelcode=pc105<wait>",
+ " debconf/frontend=noninteractive<wait>",
+ " debian-installer=en_US<wait>",
+ " fb=false<wait>",
+ " initrd=/install/initrd.gz<wait>",
+ " kbd-chooser/method=us<wait>",
+ " keyboard-configuration/layout=USA<wait>",
+ " keyboard-configuration/variant=USA<wait>",
+ " passwd/root-password={{ user `password` }} ",
+ " passwd/root-password-again={{ user `password` }} ",
+ " locale=en_US<wait>",
+ " netcfg/get_hostname=ubuntu<wait>",
+ " netcfg/get_domain=local<wait>",
+ " noapic<wait>",
+ " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
+ " -- <wait>",
+ "<enter><wait>"
+ ]
},
{
"type": "openstack",
diff --git a/ubuntu-16.04/template.json.qcow2 b/ubuntu-16.04/template.json.qcow2
new file mode 100644
index 0000000..ef20aaa
--- /dev/null
+++ b/ubuntu-16.04/template.json.qcow2
@@ -0,0 +1,317 @@
+{
+ "variables": {
+ "user": "root",
+ "password": "ho5uo7Uome5d",
+ "disk_size": "8000",
+ "images_cache": "{{ env `PACKER_IMAGES_CACHE` }}",
+ "ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
+ "saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
+ "saltstack_repo": "{{ env `SALTSTACK_REPO` }}",
+ "do_api_token": "{{ env `DO_API_TOKEN` }}",
+ "image_name": "{{ env `IMAGE_NAME` }}",
+ "os_username": "{{ env `OS_USERNAME` }}",
+ "os_password": "{{ env `OS_PASSWORD` }}",
+ "os_image": "7451fac0-0ce5-4d30-ae36-cd9a90e7948e",
+ "os_endpoint": "https://cloud-cz.bud.mirantis.net:5000/v2.0",
+ "os_zone": "mcp-mk",
+ "os_floating_ip_pool": "public",
+ "os_tenant": "26e4dd19485249608ee3685f254f3909",
+ "os_network": "772f8ca6-1f4a-4535-99d0-880d6ead9a82"
+ },
+ "provisioners": [
+ {
+ "type": "shell",
+ "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
+ "expect_disconnect": "true",
+ "environment_vars": [
+ "UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}",
+ "SALTSTACK_GPG={{ user `saltstack_gpg` }}",
+ "SALTSTACK_REPO={{ user `saltstack_repo` }}"
+ ],
+ "override": {
+ "virtualbox-iso": {
+ "scripts": [
+ "scripts/base.sh",
+ "scripts/motd.sh",
+ "scripts/salt.sh",
+ "scripts/network.sh",
+ "scripts/vagrant.sh",
+ "scripts/virtualbox.sh",
+ "scripts/security.sh",
+ "scripts/cleanup.sh",
+ "scripts/zerodisk.sh"
+ ]
+ },
+ "vmware-iso": {
+ "scripts": [
+ "scripts/base.sh",
+ "scripts/motd.sh",
+ "scripts/salt.sh",
+ "scripts/vmware.sh",
+ "scripts/security.sh",
+ "scripts/cleanup.sh",
+ "scripts/zerodisk.sh"
+ ]
+ },
+ "qemu": {
+ "scripts": [
+ "scripts/base.sh",
+ "scripts/motd.sh",
+ "scripts/salt.sh",
+ "scripts/network.sh",
+ "scripts/security.sh",
+ "scripts/cleanup.sh",
+ "scripts/info.sh",
+ "scripts/zerodisk.sh"
+ ]
+ },
+ "openstack": {
+ "scripts": [
+ "scripts/base.sh",
+ "scripts/motd.sh",
+ "scripts/salt.sh",
+ "scripts/network.sh",
+ "scripts/security.sh",
+ "scripts/cleanup.sh",
+ "scripts/info.sh",
+ "scripts/zerodisk.sh"
+ ]
+ },
+ "docker": {
+ "scripts": [
+ "scripts/docker.sh",
+ "scripts/base.sh",
+ "scripts/motd.sh",
+ "scripts/salt.sh",
+ "scripts/cleanup.sh"
+ ]
+ },
+ "digitalocean": {
+ "scripts": [
+ "scripts/base.sh",
+ "scripts/motd.sh",
+ "scripts/salt.sh",
+ "scripts/security.sh",
+ "scripts/cleanup.sh"
+ ]
+ }
+ }
+ },
+ {
+ "type": "file",
+ "source": "files/etc/",
+ "destination": "/etc"
+ }
+ ],
+ "post-processors": [
+ {
+ "type": "vagrant",
+ "keep_input_artifact": true,
+ "output": "images/{{ user `image_name` }}-{{.Provider}}-{{ isotime \"200601021504\" }}.box",
+ "except": [
+ "digitalocean",
+ "docker"
+ ]
+ },
+ {
+ "type": "docker-tag",
+ "repository": "tcpcloud/ubuntu",
+ "tag": "16.04",
+ "only": [
+ "docker"
+ ]
+ },
+ {
+ "type": "docker-save",
+ "path": "images/{{ user `image_name` }}-docker-{{ isotime \"200601021504\" }}.tar",
+ "only": [
+ "docker"
+ ]
+ }
+ ],
+ "builders": [
+ {
+ "type": "virtualbox-iso",
+ "boot_command": [
+ "<esc><wait>",
+ "<esc><wait>",
+ "<enter><wait>",
+ "/install/vmlinuz<wait>",
+ " auto<wait>",
+ " console-setup/ask_detect=false<wait>",
+ " console-setup/layoutcode=us<wait>",
+ " console-setup/modelcode=pc105<wait>",
+ " debconf/frontend=noninteractive<wait>",
+ " debian-installer=en_US<wait>",
+ " fb=false<wait>",
+ " initrd=/install/initrd.gz<wait>",
+ " kbd-chooser/method=us<wait>",
+ " keyboard-configuration/layout=USA<wait>",
+ " keyboard-configuration/variant=USA<wait>",
+ " passwd/root-password={{ user `password` }} ",
+ " passwd/root-password-again={{ user `password` }} ",
+ " locale=en_US<wait>",
+ " netcfg/get_hostname=ubuntu-1604<wait>",
+ " netcfg/get_domain=cloudlab.cz<wait>",
+ " noapic<wait>",
+ " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
+ " -- <wait>",
+ "<enter><wait>"
+ ],
+ "boot_wait": "5s",
+ "disk_size": "{{ user `disk_size`}}",
+ "output_directory": "images/{{ user `image_name`}}",
+ "guest_os_type": "Ubuntu_64",
+ "http_directory": "http",
+ "iso_checksum": "10fcd20619dce11fe094e960c85ba4a9",
+ "iso_checksum_type": "md5",
+ "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.3-server-amd64.iso",
+ "ssh_username": "{{ user `user` }}",
+ "ssh_password": "{{ user `password` }}",
+ "ssh_port": 22,
+ "ssh_wait_timeout": "10000s",
+ "shutdown_command": "shutdown -P now",
+ "headless": true,
+ "vboxmanage": [
+ [
+ "modifyvm",
+ "{{.Name}}",
+ "--memory",
+ "1024"
+ ],
+ [
+ "modifyvm",
+ "{{.Name}}",
+ "--cpus",
+ "2"
+ ],
+ [
+ "modifyvm",
+ "{{.Name}}",
+ "--vrde",
+ "on"
+ ],
+ [
+ "modifyvm",
+ "{{.Name}}",
+ "--vrdeport",
+ "5000-5050"
+ ],
+ [
+ "modifyvm",
+ "{{.Name}}",
+ "--vrdeaddress",
+ "127.0.0.1"
+ ]
+ ]
+ },
+ {
+ "type": "vmware-iso",
+ "boot_command": [
+ "<esc><wait>",
+ "<esc><wait>",
+ "<enter><wait>",
+ "/install/vmlinuz<wait>",
+ " auto<wait>",
+ " console-setup/ask_detect=false<wait>",
+ " console-setup/layoutcode=us<wait>",
+ " console-setup/modelcode=pc105<wait>",
+ " debconf/frontend=noninteractive<wait>",
+ " debian-installer=en_US<wait>",
+ " fb=false<wait>",
+ " initrd=/install/initrd.gz<wait>",
+ " kbd-chooser/method=us<wait>",
+ " keyboard-configuration/layout=USA<wait>",
+ " keyboard-configuration/variant=USA<wait>",
+ " passwd/root-password={{user `password`}} ",
+ " passwd/root-password-again={{user `password`}} ",
+ " locale=en_US<wait>",
+ " netcfg/get_hostname=ubuntu-1604<wait>",
+ " netcfg/get_domain=changeme<wait>",
+ " noapic<wait>",
+ " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
+ " -- <wait>",
+ "<enter><wait>"
+ ],
+ "boot_wait": "5s",
+ "disk_size": "{{ user `disk_size`}}",
+ "disk_type_id": 4,
+ "vmdk_name": "{{ user `image_name`}}",
+ "output_directory": "images/{{ user `image_name`}}",
+ "guest_os_type": "linux",
+ "http_directory": "http",
+ "iso_checksum": "10fcd20619dce11fe094e960c85ba4a9",
+ "iso_checksum_type": "md5",
+ "iso_url": "http://releases.ubuntu.com/16.04/ubuntu-16.04.3-server-amd64.iso",
+ "ssh_username": "{{user `user`}}",
+ "ssh_password": "{{user `password`}}",
+ "ssh_port": 22,
+ "ssh_wait_timeout": "10000s",
+ "shutdown_command": "shutdown -P now",
+ "vmx_data": {
+ "memsize": "1024",
+ "numvcpus": "1",
+ "cpuid.coresPerSocket": "1"
+ }
+ },
+ {
+ "type": "docker",
+ "image": "ubuntu:16.04",
+ "commit": true
+ },
+ {
+ "type": "digitalocean",
+ "api_token": "{{user `do_api_token`}}",
+ "image": "{{user `image_name`}}",
+ "snapshot_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
+ "region": "ams2",
+ "size": "1gb"
+ },
+ {
+ "type": "qemu",
+ "qemuargs": [
+ [ "-m", "1024M" ],
+ [ "-cdrom", "config-drive/cloudata.iso" ],
+ ["-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" ]
+ ],
+ "vm_name": "{{ user `image_name` }}-{{ isotime \"200601021504\" }}",
+ "output_directory": "images/{{ user `image_name` }}-qemu-{{ isotime \"200601021504\" }}",
+ "format": "qcow2",
+ "iso_checksum": "566efef1d6f12e7d3a994c2405bdb642",
+ "iso_checksum_type": "md5",
+ "iso_url": "http://cloud-images.ubuntu.com/releases/xenial/release-20180306/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
+ "iso_target_path": "{{ user `images_cache`}}/release-20180306_xenial-server-cloudimg-amd64-disk1.img",
+ "disk_image": true,
+ "disk_compression": true,
+ "accelerator": "kvm",
+ "disk_size": "{{ user `disk_size`}}",
+ "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",
+ "boot_wait": "2s",
+ "ssh_wait_timeout": "360s"
+ },
+ {
+ "type": "openstack",
+ "ssh_username": "{{user `user`}}",
+ "ssh_password": "{{user `password`}}",
+ "image_name": "{{user `image_name`}}",
+ "floating_ip_pool": "{{user `os_floating_ip_pool`}}",
+ "reuse_ips": "true",
+ "source_image": "{{ user `os_image` }}",
+ "flavor": "{{ user `os_flavor` }}",
+ "user_data_file": "config-drive/user-data.yaml",
+ "tenant_id": "{{ user `os_tenant` }}",
+ "networks": ["{{ user `os_network` }}"],
+ "availability_zone": "{{user `os_zone`}}",
+ "identity_endpoint": "{{user `os_endpoint`}}",
+ "username": "{{user `os_username`}}",
+ "password": "{{user `os_password`}}"
+ }
+ ]
+}