commit 1a5539fa14cfeb0c0e9971622ad95a223fae7524 Author: pg Date: Sun Nov 8 14:49:59 2015 +0100 t push -u origin master diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c1459b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.git +*.swp +packer_cache/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..714bfd9 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +#Packer.io + +##Machine image builder + +To launch build + +```sh +$ packer build os/debian8.2/debian.conf +``` + +to host preseed file + +``` +cd os/debian8.2/ +python -m SimpleHTTPServer #this is a hack beware that debian.conf (and thu the user password here publicly accessible) + +``` + diff --git a/os/debian8.2/debian.conf b/os/debian8.2/debian.conf new file mode 100644 index 0000000..9dd5473 --- /dev/null +++ b/os/debian8.2/debian.conf @@ -0,0 +1,41 @@ +{ + "variables": { + "ssh_name": "kappataumu", + "ssh_pass": "kappataumu", + "hostname": "packer-test" + }, + + "builders": [{ + "type": "virtualbox-iso", + "guest_os_type": "Ubuntu_64", + + "vboxmanage": [ + ["modifyvm", "{{.Name}}", "--vram", "32"] + ], + + "disk_size" : 10000, + + "iso_url": "http://ftp.free.fr/mirrors/cdimage.debian.org/debian-cd/8.2.0/amd64/iso-cd/debian-8.2.0-amd64-netinst.iso", + "iso_checksum_type": "sha1", + "iso_checksum": "a41801dcc0e37bce2406e18b334f99ae366d6fde", + "http_directory" : "ubuntu_64", + "http_port_min" : 9001, + "http_port_max" : 9001, + + "ssh_username": "{{user `ssh_name`}}", + "ssh_password": "{{user `ssh_pass`}}", + "ssh_wait_timeout": "20m", + + "shutdown_command": "echo {{user `ssh_pass`}} | sudo -S shutdown -P now", + + "boot_command" : + [ + "", + "auto ", + "preseed/url=http://192.168.52.152:8000/preseed.cfg ", + "" + ] + + }] +} + diff --git a/os/debian8.2/preseed.cfg b/os/debian8.2/preseed.cfg new file mode 100644 index 0000000..bf9da96 --- /dev/null +++ b/os/debian8.2/preseed.cfg @@ -0,0 +1,59 @@ +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 + +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 +