Support for centos-7 image
diff --git a/centos-7.0/http/ks.cfg b/centos-7.0/http/ks.cfg
new file mode 100644
index 0000000..8b665c3
--- /dev/null
+++ b/centos-7.0/http/ks.cfg
@@ -0,0 +1,30 @@
+install
+cdrom
+lang en_US.UTF-8
+keyboard us
+network --onboot yes --device eth0 --bootproto dhcp --noipv6
+rootpw --plaintext ho5uo7Uome5d
+firewall --enabled --service=ssh
+authconfig --enableshadow --passalgo=sha512
+selinux --disabled
+timezone Europe/Prague
+bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
+
+text
+skipx
+zerombr
+
+clearpart --all --initlabel
+autopart
+
+auth  --useshadow  --enablemd5
+firstboot --disabled
+reboot
+
+%packages --ignoremissing
+@core
+bzip2
+-ipw2100-firmware
+-ipw2200-firmware
+-ivtv-firmware
+%end
diff --git a/centos-7.0/scripts/base.sh b/centos-7.0/scripts/base.sh
new file mode 100644
index 0000000..7f56bd8
--- /dev/null
+++ b/centos-7.0/scripts/base.sh
@@ -0,0 +1,14 @@
+yum -y install curl wget
+
+wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
+rpm -i epel-release-7-5.noarch.rpm
+
+yum -y update
+yum -y install tmux vim-enhanced htop byobu cloud-init
+
+# Tmux fixes
+cat << 'EOF' >> /etc/tmux.conf
+set -g default-terminal "screen-256color"
+set -g set-titles on
+set -g xterm-keys on
+EOF
diff --git a/centos-7.0/scripts/cleanup.sh b/centos-7.0/scripts/cleanup.sh
new file mode 100644
index 0000000..a6b5d9f
--- /dev/null
+++ b/centos-7.0/scripts/cleanup.sh
@@ -0,0 +1,19 @@
+echo "cleaning up packages"
+yum -y clean all
+
+echo "cleaning up hostname"
+sed -i "/.*debian-8.*/d" /etc/hosts
+
+echo "cleaning up guest additions"
+rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.? || true
+
+echo "cleaning up dhcp leases"
+rm -f /var/lib/dhcp/* || true
+
+echo "cleaning up udev rules"
+rm -f /etc/udev/rules.d/70-persistent-net.rules || true
+rm -rf /dev/.udev/ || true
+rm -f /lib/udev/rules.d/75-persistent-net-generator.rules || true
+
+echo "cleaning up minion_id for salt"
+rm -f /etc/salt/minion_id || true
diff --git a/centos-7.0/scripts/salt.sh b/centos-7.0/scripts/salt.sh
new file mode 100644
index 0000000..0bbe7f2
--- /dev/null
+++ b/centos-7.0/scripts/salt.sh
@@ -0,0 +1 @@
+yum install -y salt-minion
diff --git a/centos-7.0/scripts/security.sh b/centos-7.0/scripts/security.sh
new file mode 100644
index 0000000..5cd8159
--- /dev/null
+++ b/centos-7.0/scripts/security.sh
@@ -0,0 +1,50 @@
+# Auto login root on tty1
+sed 's|/sbin/agetty|/sbin/agetty --autologin root|g' /etc/systemd/system/getty.target.wants/getty@tty1.service > /etc/systemd/system/getty-autologin@.service
+systemctl daemon-reload
+systemctl disable getty@tty1.service
+systemctl enable getty-autologin@tty1.service
+
+# Libvirt serial console support
+cat << 'EOF' >> /etc/systemd/system/getty-serial@.service
+[Unit]
+Description=Getty on %I
+Documentation=man:agetty(8) man:systemd-getty-generator(8)
+Documentation=http://0pointer.de/blog/projects/serial-console.html
+After=systemd-user-sessions.service plymouth-quit-wait.service
+After=rc-local.service
+
+Before=getty.target
+IgnoreOnIsolate=yes
+
+ConditionPathExists=/dev/ttyS0
+
+[Service]
+ExecStart=-/sbin/agetty --autologin root -8 --noclear %I 115200 $TERM
+Type=idle
+Restart=always
+RestartSec=0
+UtmpIdentifier=%I
+TTYPath=/dev/%I
+TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
+KillMode=process
+IgnoreSIGPIPE=no
+SendSIGHUP=yes
+
+Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
+
+[Install]
+WantedBy=getty.target
+DefaultInstance=ttyS0
+EOF
+
+systemctl daemon-reload
+systemctl enable getty-serial@ttyS0.service
+
+# Disable password root login
+usermod -p '!' root
+
+# Disable SSH password authentication and permit root login
+sed -i 's|[#]*PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config
+sed -i 's|[#]*PermitRootLogin no|PermitRootLogin yes|g' /etc/ssh/sshd_config
diff --git a/centos-7.0/scripts/vagrant.sh b/centos-7.0/scripts/vagrant.sh
new file mode 100644
index 0000000..06b02cf
--- /dev/null
+++ b/centos-7.0/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/centos-7.0/scripts/virtualbox.sh b/centos-7.0/scripts/virtualbox.sh
new file mode 100644
index 0000000..ba53d21
--- /dev/null
+++ b/centos-7.0/scripts/virtualbox.sh
@@ -0,0 +1,7 @@
+VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
+cd /tmp
+mount -o loop /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
+sh /mnt/VBoxLinuxAdditions.run
+umount /mnt
+rm -rf /home/vagrant/VBoxGuestAdditions_*.iso
+
diff --git a/centos-7.0/scripts/zerodisk.sh b/centos-7.0/scripts/zerodisk.sh
new file mode 100644
index 0000000..6a658ed
--- /dev/null
+++ b/centos-7.0/scripts/zerodisk.sh
@@ -0,0 +1,2 @@
+dd if=/dev/zero of=/EMPTY bs=1M || true
+rm -f /EMPTY
diff --git a/centos-7.0/template.json b/centos-7.0/template.json
new file mode 100644
index 0000000..47cf5de
--- /dev/null
+++ b/centos-7.0/template.json
@@ -0,0 +1,125 @@
+{
+  "variables": {
+        "user": "root",
+        "password": "ho5uo7Uome5d",
+        "do_api_token": "{{ env `DO_API_TOKEN` }}",
+        "distro": "centos-7",
+        "disk_size": "8000"
+   },
+  "provisioners": [
+    {
+      "type": "shell",
+      "execute_command": "sh '{{.Path}}'",
+      "override": {
+        "virtualbox-iso": {
+          "scripts": [
+            "scripts/base.sh",
+	    "scripts/salt.sh",
+            "scripts/vagrant.sh",
+            "scripts/virtualbox.sh",
+            "scripts/security.sh",
+            "scripts/cleanup.sh",
+            "scripts/zerodisk.sh"
+          ]
+        },
+        "vmware-iso": {
+          "scripts": [
+            "scripts/base.sh",
+	    "scripts/salt.sh",
+            "scripts/vmware.sh",
+            "scripts/security.sh",
+            "scripts/cleanup.sh",
+            "scripts/zerodisk.sh"
+          ]
+        },
+	"qemu": {
+          "scripts": [
+            "scripts/base.sh",
+	    "scripts/salt.sh",
+            "scripts/security.sh",
+            "scripts/cleanup.sh",
+            "scripts/zerodisk.sh"
+          ]
+	}
+      }
+    }
+  ],
+  "post-processors": [
+    {
+      "type": "vagrant",
+      "keep_input_artifact": true,
+      "output": "images/{{ user `distro` }}-{{.Provider}}-{{ timestamp }}.box"
+    }
+  ],
+  "builders": [
+    {
+      "type": "virtualbox-iso",
+      "boot_command": [
+        "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
+      ],
+      "boot_wait": "10s",
+      "disk_size": 5020,
+      "guest_os_type": "RedHat_64",
+      "http_directory": "http",
+      "iso_checksum": "88c0437f0a14c6e2c94426df9d43cd67",
+      "iso_checksum_type": "sha1",
+      "iso_url": "http://ftp.cvut.cz/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso",
+      "ssh_username": "{{user `user`}}",
+      "ssh_password": "{{user `password`}}",
+      "ssh_port": 22,
+      "ssh_wait_timeout": "10000s",
+      "shutdown_command": "shutdown -P now",
+      "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso",
+      "virtualbox_version_file": ".vbox_version",
+      "vboxmanage": [
+        [ "modifyvm", "{{.Name}}", "--memory", "512" ],
+        [ "modifyvm", "{{.Name}}", "--cpus", "1" ]
+      ]
+    },
+    {
+      "type": "qemu",
+      "vm_name": "{{ user `distro` }}-{{ timestamp  }}",
+      "output_directory": "images/{{ user `distro` }}-{{ timestamp  }}",
+      "format": "qcow2",
+      "accelerator": "kvm",
+      "disk_size": "{{ user `disk_size`}}",
+      "iso_checksum": "88c0437f0a14c6e2c94426df9d43cd67",
+      "iso_checksum_type": "md5",
+      "iso_url": "http://ftp.cvut.cz/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso",
+      "http_directory": "http",
+      "headless": true,
+      "ssh_username": "{{user `user`}}",
+      "ssh_password": "{{user `password`}}",
+      "ssh_wait_timeout": "10000s",
+      "shutdown_command": "shutdown -P now",
+      "boot_wait": "2s",
+      "boot_command": [
+      "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
+     ]
+    },
+    {
+      "type": "vmware-iso",
+      "boot_command": [
+        "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
+      ],
+      "boot_wait": "10s",
+      "disk_size": 40520,
+      "guest_os_type": "centos-64",
+      "http_directory": "http",
+      "iso_checksum": "154ba47b7a37e52e0100310c3aeb8f9d9daf4806",
+      "iso_checksum_type": "sha1",
+      "iso_url": "http://ftp.cvut.cz/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso",
+      "ssh_username": "{{user `user`}}",
+      "ssh_password": "{{user `password`}}",
+      "ssh_port": 22,
+      "ssh_wait_timeout": "10000s",
+      "shutdown_command": "shutdown -P now",
+      "tools_upload_flavor": "linux",
+      "vmx_data": {
+        "memsize": "512",
+        "numvcpus": "1",
+        "cpuid.coresPerSocket": "1"
+      }
+    }
+  ]
+}