clever_vm: Create base image file

This commit is contained in:
Alexey Rogachevskiy
2020-02-23 23:06:21 +03:00
parent e667b155ce
commit b99ec328bb
2 changed files with 121 additions and 0 deletions

42
base_vm.json Normal file
View File

@@ -0,0 +1,42 @@
{
"variables" : {
"user": "clever",
"password": "clever",
"vm-name": "clever-devel"
},
"builders": [{
"type": "virtualbox-iso",
"vm_name": "{{user `vm-name`}}",
"guest_os_type": "Ubuntu_64",
"format": "ova",
"guest_additions_mode": "upload",
"disk_size": "30000",
"hard_drive_interface": "sata",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "4096", "--vram", "128", "--mouse", "usbtablet", "--accelerate3d", "on", "--apic", "on", "--rtcuseutc", "on", "--graphicscontroller", "vmsvga"],
["storageattach", "{{.Name}}", "--storagectl", "SATA Controller", "--port", "0", "--nonrotational", "on", "--discard", "on"]
],
"iso_url": "http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso",
"iso_checksum": "bed8a55ae2a657f8349fe3271097cff3a5b8c3d1048cf258568f1601976fa30d",
"iso_checksum_type": "sha256",
"ssh_password": "{{user `password`}}",
"ssh_username": "{{user `user`}}",
"ssh_wait_timeout": "10000s",
"boot_command": [
"<esc><wait>",
"install auto=true priority=critical url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg",
"<enter><wait>"
],
"boot_wait": "4s",
"http_directory": "http",
"shutdown_command": "echo {{user `password`}} | sudo -S shutdown -P now",
"vboxmanage_post": [
["modifyhd", "output-virtualbox-iso/{{.Name}}.vdi", "--compact"]
]
}]
}

79
http/preseed.cfg Normal file
View File

@@ -0,0 +1,79 @@
# ubiquity ubiquity/summary
# Choices: Dialog, Readline, Gnome, Kde, Editor, Noninteractive
d-i debconf debconf/frontend select Noninteractive
### Localization
d-i debian-installer/locale string en_US.utf8
### Keyboard selection
d-i console-setup/ask_detect boolean false
d-i console-setup/layout select us
d-i console-setup/variant select us
ubiquity languagechooser/language-name select English (US)
ubiquity countrychooser/shortlist select US
ubiquity keyboard-configuration/layoutcode select us
ubiquity keyboard-configuration/modelcode select pc105
ubiquity localechooser/supported-locales multiselect en_US.UTF8
ubiquity console-keymaps-at/keymap select us
ubiquity console-keymaps-at/variant select us
d-i kbd-chooser/method select British English
### Network
d-i netcfg/get_hostname string clever-devel
d-i netcfg/get_domain string unassigned-domain
### Clock and time zone setup
d-i time/zone string Europe/Moscow
d-i clock-setup/utc-auto boolean true
d-i clock-setup/utc boolean true
### Partitioning
d-i partman-auto/method string regular
d-i partman/confirm_write_new_label boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
### Account setup
d-i passwd/user-fullname string clever
d-i passwd/username string clever
d-i passwd/user-password password clever
d-i passwd/user-password-again password clever
d-i passwd/auto-login boolean true
d-i user-setup/encrypt-home boolean false
d-i user-setup/allow-password-weak boolean true
### Package installation
# Enable extras.ubuntu.com.
d-i apt-setup/extras boolean true
# Install the Ubuntu desktop.
tasksel tasksel/first multiselect xubuntu-core openssh-server
choose-mirror-bin mirror/http/proxy string
#For the update
d-i pkgsel/update-policy select none
d-i pkgsel/install-language-support boolean false
d-i pkgsel/upgrade select none
##Trying to install openssh-server
#d-i pkgsel/include string openssh-server
#d-i preseed/late_command string apt-install openssh-server
#ubiquity ubiquity/success_command string apt-install openssh-server
#d-i preseed/late_command string in-target apt-get install -y openssh-server
# ubiquity ubiquity/success_command string grep -wo url='[^[:space:]]*\.cfg' /proc/cmdline |sed 's,cfg$,sh,;s,url=,,' |xargs wget -qO- |sh
## The only method that works
# ubiquity ubiquity/success_command string in-target apt-get install -y openssh-server
### Bootloader
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
### Reboot after preseeding
d-i finish-install/reboot_in_progress note
ubiquity ubiquity/reboot boolean true
#ubiquity ubiquity/poweroff boolean true