initial version
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..62534fc
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,10 @@
+# ChangeLog
+
+### Version 0.1
+
+* kvm to qcow2 image + vagrant qemu box
+* virtualbox to vdi image + vagrant virtualbox box
+* DigitalOcean provisioning to official image (used to boot new instances)
+* vmware to vdi? - this is untested
+* just **Ubuntu 14.04** now
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1ad69a7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,39 @@
+# Packer templates
+
+Packer templates are used to:
+
+  - automagically create OS images with upgraded packages
+  - provision user defined changes to created image
+  - remove user defined elements from image
+  - build single version of OS image for multiple hypervisors
+
+### Usage
+
+#### Configuration
+
+Source the config script and set prefered parameters for build
+```sh
+. ./config.sh
+```
+### Image build
+
+Enter build directory by selecting OS type and version.
+You should see file **template.json**.
+
+Start building some images:
+```sh
+packer build template.json 
+```
+
+### Development
+
+Directory *http/* contains OS installer config files (preseed/kickstart/..)
+
+Directory *scripts/* contains set of scripts for provision after image build.
+
+### Notes
+
+- see *Changelog.md* file for supported builders and operating systems
+- some builders cannot work at the same time (by design)
+
+
diff --git a/config.sh b/config.sh
new file mode 100644
index 0000000..d4719df
--- /dev/null
+++ b/config.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+echo "Please enter your DigitalOcean API key: "
+echo "(if not used put some random stuff)"
+read -sr DO_API_TOKEN_INPUT
+export DO_API_TOKEN=$DO_API_TOKEN_INPUT
+echo "Please enter provision username: "
+read -r BUILD_USER_INPUT
+export BUILD_USER=$BUILD_USER_INPUT
+echo "Please enter provision password: "
+read -sr BUILD_PASSWORD_INPUT
+export BUILD_PASSWORD=$BUILD_PASSWORD_INPUT
+
diff --git a/ubuntu-14.04/.gitignore b/ubuntu-14.04/.gitignore
new file mode 100644
index 0000000..336d238
--- /dev/null
+++ b/ubuntu-14.04/.gitignore
@@ -0,0 +1,3 @@
+images/
+packer_cache/
+
diff --git a/ubuntu-14.04/http/preseed.cfg b/ubuntu-14.04/http/preseed.cfg
new file mode 100644
index 0000000..06c2ddd
--- /dev/null
+++ b/ubuntu-14.04/http/preseed.cfg
@@ -0,0 +1,28 @@
+choose-mirror-bin mirror/http/proxy string
+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/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 pkgsel/include string openssh-server
+d-i pkgsel/install-language-support boolean false
+d-i pkgsel/update-policy select unattended-upgrades
+popularity-contest popularity-contest/participate boolean false
+
+d-i pkgsel/upgrade select none
+
+d-i time/zone string UTC
+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
diff --git a/ubuntu-14.04/scripts/base.sh b/ubuntu-14.04/scripts/base.sh
new file mode 100644
index 0000000..637173e
--- /dev/null
+++ b/ubuntu-14.04/scripts/base.sh
@@ -0,0 +1,9 @@
+apt-get update
+apt-get -y upgrade
+apt-get -y dist-upgrade
+apt-get -y install linux-headers-$(uname -r)
+
+# to be removed
+#sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=sudo' /etc/sudoers
+#sed -i -e 's/%sudo  ALL=(ALL:ALL) ALL/%sudo  ALL=NOPASSWD:ALL/g' /etc/sudoers
+
diff --git a/ubuntu-14.04/scripts/cleanup.sh b/ubuntu-14.04/scripts/cleanup.sh
new file mode 100644
index 0000000..ae0b269
--- /dev/null
+++ b/ubuntu-14.04/scripts/cleanup.sh
@@ -0,0 +1,14 @@
+apt-get -y autoremove
+apt-get -y clean
+
+echo "cleaning up guest additions"
+rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.?
+
+echo "cleaning up dhcp leases"
+rm /var/lib/dhcp/*
+
+echo "cleaning up udev rules"
+rm /etc/udev/rules.d/70-persistent-net.rules
+mkdir /etc/udev/rules.d/70-persistent-net.rules
+rm -rf /dev/.udev/
+rm /lib/udev/rules.d/75-persistent-net-generator.rules
diff --git a/ubuntu-14.04/scripts/salt.sh b/ubuntu-14.04/scripts/salt.sh
new file mode 100644
index 0000000..fd8a5ab
--- /dev/null
+++ b/ubuntu-14.04/scripts/salt.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+curl -L https://bootstrap.saltstack.com | sudo sh -s --
+
diff --git a/ubuntu-14.04/scripts/vagrant.sh b/ubuntu-14.04/scripts/vagrant.sh
new file mode 100644
index 0000000..06b02cf
--- /dev/null
+++ b/ubuntu-14.04/scripts/vagrant.sh
@@ -0,0 +1,7 @@
+
+mkdir /home/vagrant/.ssh
+wget --no-check-certificate \
+    'https://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' \
+    -O /home/vagrant/.ssh/authorized_keys
+chown -R vagrant /home/vagrant/.ssh
+chmod -R go-rwsx /home/vagrant/.ssh
diff --git a/ubuntu-14.04/scripts/virtualbox.sh b/ubuntu-14.04/scripts/virtualbox.sh
new file mode 100644
index 0000000..f42d6d6
--- /dev/null
+++ b/ubuntu-14.04/scripts/virtualbox.sh
@@ -0,0 +1 @@
+apt-get -y install virtualbox-guest-utils
diff --git a/ubuntu-14.04/scripts/vmware.sh b/ubuntu-14.04/scripts/vmware.sh
new file mode 100644
index 0000000..05b0af0
--- /dev/null
+++ b/ubuntu-14.04/scripts/vmware.sh
@@ -0,0 +1,2 @@
+apt-get -y install open-vm-tools
+echo -n ".host:/ /mnt/hgfs vmhgfs rw,ttl=1,uid=my_uid,gid=my_gid,nobootwait 0 0" >> /etc/fstab
diff --git a/ubuntu-14.04/scripts/zerodisk.sh b/ubuntu-14.04/scripts/zerodisk.sh
new file mode 100644
index 0000000..4daf0e8
--- /dev/null
+++ b/ubuntu-14.04/scripts/zerodisk.sh
@@ -0,0 +1,2 @@
+dd if=/dev/zero of=/EMPTY bs=1M
+rm -f /EMPTY
diff --git a/ubuntu-14.04/template.json b/ubuntu-14.04/template.json
new file mode 100644
index 0000000..b93c6a5
--- /dev/null
+++ b/ubuntu-14.04/template.json
@@ -0,0 +1,221 @@
+{
+   "variables": {
+        "user": "{{ env `BUILD_USER` }}",
+        "password": "{{ env `BUILD_PASSWORD` }}",
+	"do_api_token": "{{ env `DO_API_TOKEN` }}",
+	"distro": "ubuntu-14-04-x64",
+        "disk_size": 8000 
+   },
+
+  "provisioners": [
+    {
+      "type": "shell",
+      "execute_command": "echo '{{user `user`}}' |sudo -S sh '{{.Path}}'",
+      "override": {
+        "virtualbox-iso": {
+          "scripts": [
+            "scripts/base.sh",
+	    "scripts/salt.sh",
+            "scripts/vagrant.sh",
+            "scripts/virtualbox.sh",
+            "scripts/cleanup.sh",
+            "scripts/zerodisk.sh"
+          ]
+        },
+        "vmware-iso": {
+          "scripts": [
+            "scripts/base.sh",
+            "scripts/vagrant.sh",
+            "scripts/vmware.sh",
+            "scripts/cleanup.sh",
+            "scripts/zerodisk.sh"
+          ]
+        },
+	"qemu": {
+          "scripts": [
+            "scripts/base.sh",
+	    "scripts/salt.sh",
+            "scripts/cleanup.sh",
+            "scripts/zerodisk.sh"
+          ]
+	},
+	"digitalocean": {
+	  "scripts": [
+	    "scripts/base.sh",
+	    "scripts/salt.sh",
+	    "scripts/cleanup.sh"
+	  ]
+	}
+      }
+    }
+  ],
+  "post-processors": [
+    {
+      "type": "vagrant",
+      "keep_input_artifact": true,
+      "except": "digitalocean",
+      "override": {
+        "virtualbox": {
+          "output": "{{ user `distro` }}-vbox-{{ timestamp }}.box"
+        },
+        "vmware": {
+          "output": "{{ user `distro` }}-vmware-{{ timestamp }}.box"
+        },
+	"qemu": {
+	  "output": "{{ user `distro` }}-qemu-{{ timestamp }}.box"
+	}
+      },
+      "except": [ "digitalocean" ]
+    }
+  ],
+  "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/user-fullname={{user `user`}} ",
+        " passwd/user-password-again={{user `password`}} ",
+        " passwd/user-password={{user `password`}} ",
+        " passwd/username={{user `user`}} ",
+        " locale=en_US<wait>",
+        " netcfg/get_hostname=ubuntu-1404<wait>",
+        " netcfg/get_domain=vagrantup.com<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 `distro` }}-{{ timestamp  }}",
+      "guest_os_type": "Ubuntu_64",
+      "http_directory": "http",
+      "iso_checksum": "01545fa976c8367b4f0d59169ac4866c",
+      "iso_checksum_type": "md5",
+      "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04-server-amd64.iso",
+      "ssh_username": "{{user `user`}}",
+      "ssh_password": "{{user `password`}}",
+      "ssh_port": 22,
+      "ssh_wait_timeout": "10000s",
+      "shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -P now",
+      "vboxmanage": [
+        [ "modifyvm", "{{.Name}}", "--memory", "1024" ],
+        [ "modifyvm", "{{.Name}}", "--cpus", "2" ]
+      ]
+    },
+    {
+      "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/user-fullname={{user `user`}} ",
+        " passwd/user-password-again={{user `password`}} ",
+        " passwd/user-password={{user `password`}} ",
+        " passwd/username={{user `user`}} ",
+        " locale=en_US<wait>",
+        " netcfg/get_hostname=ubuntu-1404<wait>",
+        " netcfg/get_domain=vagrantup.com<wait>",
+        " noapic<wait>",
+        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
+        " -- <wait>",
+        "<enter><wait>"
+      ],
+      "boot_wait": "5s",
+      "disk_size": "{{ user `disk_size`}}",
+      "guest_os_type": "linux",
+      "http_directory": "http",
+      "iso_checksum": "01545fa976c8367b4f0d59169ac4866c",
+      "iso_checksum_type": "md5",
+      "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04-server-amd64.iso",
+      "ssh_username": "{{user `user`}}",
+      "ssh_password": "{{user `password`}}",
+      "ssh_port": 22,
+      "ssh_wait_timeout": "10000s",
+      "shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -P now",
+      "vmx_data": {
+        "memsize": "512",
+        "numvcpus": "1",
+        "cpuid.coresPerSocket": "1"
+      }
+    },
+    {
+      "type": "qemu",
+      "vm_name": "{{ user `distro` }}-{{ timestamp  }}",
+      "output_directory": "images/{{ user `distro` }}-{{ timestamp  }}",
+      "format": "qcow2",
+      "accelerator": "kvm",
+      "disk_size": "{{ user `disk_size`}}",
+      "iso_url": "http://releases.ubuntu.com/14.04/ubuntu-14.04-server-amd64.iso",
+      "iso_checksum_type": "md5",
+      "iso_checksum": "01545fa976c8367b4f0d59169ac4866c",
+      "http_directory": "http",
+      "ssh_username": "{{user `user`}}",
+      "ssh_password": "{{user `password`}}",
+      "shutdown_command": "echo '{{user `password`}}'|sudo -S shutdown -P now",
+      "boot_wait": "2s",
+      "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/user-fullname={{user `user`}} ",
+        " passwd/user-password-again={{user `password`}} ",
+        " passwd/user-password={{user `password`}} ",
+        " passwd/username={{user `user`}} ",
+        " locale=en_US<wait>",
+        " netcfg/get_hostname=ubuntu-1404<wait>",
+        " netcfg/get_domain=vagrantup.com<wait>",
+        " noapic<wait>",
+        " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
+        " -- <wait>",
+        "<enter><wait>"
+     ]
+   },
+    { 
+      "type": "digitalocean",
+      "api_token": "{{user `do_api_token`}}",
+      "image": "{{user `distro`}}",
+      "snapshot_name": "{{ user `distro` }}-{{ timestamp  }}",
+      "region" : "ams2",
+      "size" : "1gb"
+    }
+  ]
+}