commit 26eeb4cc6cccfdd2844baa718ff0f81c7fd1bf1e from: Sergey Bronnikov date: Tue Nov 24 11:23:09 2015 UTC Merge pull request #5 from legal90/merge-subdirs DRY: Share duplicated files, merge project sub-directories commit - 3d7d27be517901f17b5d0e4a3eea60baf75c839c commit + 26eeb4cc6cccfdd2844baa718ff0f81c7fd1bf1e blob - /dev/null blob + a5c3cd43ffdd735bd126fa65a8a6991593c34e45 (mode 644) --- /dev/null +++ .gitignore @@ -0,0 +1,6 @@ +*.box +packer_cache +packer.log +.DS_Store +/builds/ +/packer-*/ blob - e9e5bdc0977f46e45cad1f9a541042ef16b90323 blob + 59555e53913d6f873827f6e299d55dd8e293b986 --- README.md +++ README.md @@ -21,13 +21,28 @@ Running Packer -------------- $ git clone https://github.com/ligurio/openvz-packer-templates - $ cd openvz-packer-templates - $ packer build template.json + $ packer build virtuozzo-7.0.json If you want to build only VirtualBox: - $ packer build -only=virtualbox-iso template.json + $ packer build -only=virtualbox-iso virtuozzo-7.0.json +The result box will be available in `builds/` directory. + +### Virtuozzo 7.0 Beta 2 + +By default the box `virtuozzo-7.0` will be built using the ISO from the latest +released milestone of Virtuozzo 7.0. At this moment it is _7.0-beta1_ +If you want to build the box `virtuozzo-7.0` from the current factory ISO build, you +should override `iso_url` and `iso_checksum` variables, for example: + +```console +$ export VZ_FACTOY_URL=https://download.openvz.org/virtuozzo/factory/x86_64/iso/factory-DVD && \ + export VZ_FACTOY_CHECKSUM=`curl --silent https://download.openvz.org/virtuozzo/factory/x86_64/iso/factory-CHECKSUM | grep DVD | awk '{print $1}'` + +$ packer build -var "iso_url=${VZ_FACTOY_URL}" -var "iso_checksum=${VZ_FACTOY_CHECKSUM}" centos-6.7-x86_64.json +``` + Using Vagrant box ----------------- blob - 8b9f3e15f70a4b7a16ad7354aedd39a8974f6200 (mode 644) blob + /dev/null --- openvz-centos/http/ks.cfg +++ /dev/null @@ -1,42 +0,0 @@ -install -cdrom -lang en_US.UTF-8 -keyboard us -network --onboot yes --device eth0 --bootproto dhcp --noipv6 -rootpw --plaintext vagrant -firewall --enabled --service=ssh -authconfig --enableshadow --passalgo=sha512 -selinux --disabled -timezone Russia/Moscow -bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" - -text -skipx -zerombr - -clearpart --all --initlabel -autopart - -auth --useshadow --enablemd5 -firstboot --disabled -reboot -user --name=vagrant --plaintext --password vagrant - -%packages --ignoremissing -@core -bzip2 -%end - -%post -# Install OpenVZ kernel -curl http://ftp.openvz.org/openvz.repo > /etc/yum.repos.d/OpenVZ.repo -rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ -/usr/bin/yum install -y vzkernel vzctl vzquota ploop - -# Enable conntrack to make ssh work with default iptables configuration -sed -i "s/ip_conntrack_disable_ve0=1/ip_conntrack_disable_ve0=0/" /etc/modprobe.d/openvz.conf - -# sudo -echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant -sed -i "s/^[^#].*requiretty/#Defaults requiretty/" /etc/sudoers -%end blob - 1186cbc4dd971665facf685fdf091e66fbfc22da (mode 644) blob + /dev/null --- openvz-centos/scripts/cleanup.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -eux - -# Remove development and kernel source packages -yum -y remove gcc cpp kernel-devel kernel-headers perl -yum -y clean all - -# Clean up network interface persistence -rm -f /etc/udev/rules.d/70-persistent-net.rules; - -for ndev in `ls -1 /etc/sysconfig/network-scripts/ifcfg-*`; do - if [ "`basename $ndev`" != "ifcfg-lo" ]; then - sed -i '/^HWADDR/d' "$ndev" - sed -i '/^UUID/d' "$ndev" - fi -done blob - 54f1cf169153c9390631be5363a0516e446ce588 (mode 644) blob + /dev/null --- openvz-centos/scripts/minimize.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -eux -set +e -swapuuid="`/sbin/blkid -o value -l -s UUID -t TYPE=swap`"; -case "$?" in - 2|0) ;; - *) exit 1 ;; -esac -set -e - -if [ "x${swapuuid}" != "x" ]; then - # Whiteout the swap partition to reduce box size - # Swap is disabled till reboot - swappart="`readlink -f /dev/disk/by-uuid/$swapuuid`"; - /sbin/swapoff "$swappart"; - dd if=/dev/zero of="$swappart" bs=1M || echo "dd exit code $? is suppressed"; - /sbin/mkswap -U "$swapuuid" "$swappart"; -fi - -dd if=/dev/zero of=/EMPTY bs=1M || echo "dd exit code $? is suppressed"; -rm -f /EMPTY; -# Block until the empty file has been removed, otherwise, Packer -# will try to kill the box while the disk is still full and that's bad -sync; blob - 610d99482e75d47beecc645e40b04fb8c111147f (mode 644) blob + /dev/null --- openvz-centos/scripts/vagrant.sh +++ /dev/null @@ -1,6 +0,0 @@ -date > /etc/vagrant_box_build_time - -mkdir -pm 700 $HOME_DIR/.ssh -curl -L https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -o $HOME_DIR/.ssh/authorized_keys -chmod 0600 $HOME_DIR/.ssh/authorized_keys -chown -R openvz:openvz $HOME_DIR/.ssh blob - db57cba1c1808322d2b9cf3304cc736aa92ee8a1 (mode 644) blob + /dev/null --- openvz-centos/scripts/vmtools.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -eux - -# set a default HOME_DIR environment variable if not set -HOME_DIR="${HOME_DIR:-/home/vagrant}"; - -case "$PACKER_BUILDER_TYPE" in - -virtualbox-iso|virtualbox-ovf) - mkdir -p /tmp/vbox; - ver="`cat $HOME_DIR/.vbox_version`"; - mount -o loop $HOME_DIR/VBoxGuestAdditions_${ver}.iso /tmp/vbox; - sh /tmp/vbox/VBoxLinuxAdditions.run \ - || echo "VBoxLinuxAdditions.run exited $? and is suppressed." \ - "For more read https://www.virtualbox.org/ticket/12479"; - umount /tmp/vbox; - rm -rf /tmp/vbox; - rm -f $HOME_DIR/*.iso; - ;; - -vmware-iso|vmware-vmx) - mkdir -p /tmp/vmfusion; - mkdir -p /tmp/vmfusion-archive; - mount -o loop $HOME_DIR/linux.iso /tmp/vmfusion; - tar xzf /tmp/vmfusion/VMwareTools-*.tar.gz -C /tmp/vmfusion-archive; - /tmp/vmfusion-archive/vmware-tools-distrib/vmware-install.pl --force-install; - umount /tmp/vmfusion; - rm -rf /tmp/vmfusion; - rm -rf /tmp/vmfusion-archive; - rm -f $HOME_DIR/*.iso; - ;; - -parallels-iso|parallels-pvm) - mkdir -p /tmp/parallels; - mount -o loop $HOME_DIR/prl-tools-lin.iso /tmp/parallels; - /tmp/parallels/install --install-unattended-with-deps \ - || (code="$?"; \ - echo "Parallels tools installation exited $code, attempting" \ - "to output /var/log/parallels-tools-install.log"; \ - cat /var/log/parallels-tools-install.log; \ - exit $code); - umount /tmp/parallels; - rm -rf /tmp/parallels; - rm -f $HOME_DIR/*.iso; - ;; -*) - echo "Unknown Packer Builder Type >>$PACKER_BUILDER_TYPE<< selected."; - echo "Known are virtualbox-iso|virtualbox-ovf|vmware-iso|vmware-vmx|parallels-iso|parallels-pvm."; - ;; - -esac blob - 4fe4ef0f80cf6b8c2851f75cdb1b7fcfc5e8f59f (mode 644) blob + /dev/null --- openvz-centos/template.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "provisioners": [ - { - "type": "shell", - "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "environment_vars": [ - "HOME_DIR=/home/vagrant" - ], - "scripts": [ - "scripts/vagrant.sh", - "scripts/vmtools.sh", - "scripts/cleanup.sh", - "scripts/minimize.sh" - ] - } - ], - "post-processors": [ - { - "type": "vagrant", - "output": "openvz-centos-6.7-x64-{{.Provider}}.box" - } - ], - "builders": [ - { - "type": "virtualbox-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "RedHat_64", - "http_directory": "http", - "iso_checksum": "9d3fec5897be6b3fed4d3dda80b8fa7bb62c616bbfd4bdcd27295ca9b764f498", - "iso_checksum_type": "sha256", - "iso_url": "http://mirror.yandex.ru/centos/6.7/isos/x86_64/CentOS-6.7-x86_64-minimal.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", - "virtualbox_version_file": ".vbox_version", - "vboxmanage": [ - [ "modifyvm", "{{.Name}}", "--memory", "512" ], - [ "modifyvm", "{{.Name}}", "--cpus", "1" ] - ] - }, - { - "type": "vmware-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "RedHat_64", - "http_directory": "http", - "iso_checksum": "9d3fec5897be6b3fed4d3dda80b8fa7bb62c616bbfd4bdcd27295ca9b764f498", - "iso_checksum_type": "sha256", - "iso_url": "http://mirror.yandex.ru/centos/6.7/isos/x86_64/CentOS-6.7-x86_64-minimal.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "tools_upload_flavor": "linux", - "vmx_data": { - "memsize": "512", - "numvcpus": "1", - "cpuid.coresPerSocket": "1" - } - }, - { - "type": "parallels-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "rhel", - "http_directory": "http", - "iso_checksum": "9d3fec5897be6b3fed4d3dda80b8fa7bb62c616bbfd4bdcd27295ca9b764f498", - "iso_checksum_type": "sha256", - "iso_url": "http://mirror.yandex.ru/centos/6.7/isos/x86_64/CentOS-6.7-x86_64-minimal.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "parallels_tools_flavor": "lin", - "prlctl": [ - [ "set", "{{.Name}}", "--memsize", "512" ], - [ "set", "{{.Name}}", "--cpus", "1" ] - ], - "vm_name": "openvz-centos-6.7-x64" - } - ] -} blob - 2067b84933f36833c8dcecd60107236a7b630957 (mode 644) blob + /dev/null --- virtuozzo-6.0/http/ks.cfg +++ /dev/null @@ -1,46 +0,0 @@ -install -cdrom -lang en_US.UTF-8 -keyboard us -network --onboot yes --device eth0 --bootproto dhcp --noipv6 -rootpw --plaintext vagrant -firewall --enabled --service=ssh -authconfig --enableshadow --passalgo=sha512 -selinux --disabled -timezone Russia/Moscow -bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" - -text -skipx -zerombr - -clearpart --all --initlabel -autopart - -auth --useshadow --enablemd5 -firstboot --disabled -reboot -user --name=vagrant --plaintext --password vagrant - -%packages --ignoremissing -@core -@templates --iwl*firmware -bzip2 -%end - -%post -# Install Virtuozzo packages -#sed -i "s/^Defaults requiretty/Defaults \!requiretty/" /etc/sudoers -#/usr/bin/yum -y group install "Odin Containers" -#/usr/bin/yum -y group install "Odin Hypervisor" - -# Enable conntrack to make ssh work with default iptables configuration -sed -i "s/ip_conntrack_disable_ve0=1/ip_conntrack_disable_ve0=0/" /etc/modprobe.d/parallels.conf - -# sudo -echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant -sed -i "s/^[^#].*requiretty/#Defaults requiretty/" /etc/sudoers - -echo "ulimit -c unlimited" >> /etc/bashrc -%end blob - b90ce1faf23ae93696013970985e5549dc3a85c5 (mode 644) blob + /dev/null --- virtuozzo-6.0/scripts/cleanup.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -eux - -# Remove development and kernel source packages -yum -y remove gcc cpp kernel-devel kernel-headers perl libX11 avahi freetype -yum -y clean all - -# Clean up network interface persistence -rm -f /etc/udev/rules.d/70-persistent-net.rules; - -for ndev in `ls -1 /etc/sysconfig/network-scripts/ifcfg-*`; do - if [ "`basename $ndev`" != "ifcfg-lo" ]; then - sed -i '/^HWADDR/d' "$ndev" - sed -i '/^UUID/d' "$ndev" - fi -done blob - 54f1cf169153c9390631be5363a0516e446ce588 (mode 644) blob + /dev/null --- virtuozzo-6.0/scripts/minimize.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -eux -set +e -swapuuid="`/sbin/blkid -o value -l -s UUID -t TYPE=swap`"; -case "$?" in - 2|0) ;; - *) exit 1 ;; -esac -set -e - -if [ "x${swapuuid}" != "x" ]; then - # Whiteout the swap partition to reduce box size - # Swap is disabled till reboot - swappart="`readlink -f /dev/disk/by-uuid/$swapuuid`"; - /sbin/swapoff "$swappart"; - dd if=/dev/zero of="$swappart" bs=1M || echo "dd exit code $? is suppressed"; - /sbin/mkswap -U "$swapuuid" "$swappart"; -fi - -dd if=/dev/zero of=/EMPTY bs=1M || echo "dd exit code $? is suppressed"; -rm -f /EMPTY; -# Block until the empty file has been removed, otherwise, Packer -# will try to kill the box while the disk is still full and that's bad -sync; blob - 9595ed72ca242dba26b0abf517c382b926a1c4a6 (mode 644) blob + /dev/null --- virtuozzo-6.0/scripts/vagrant.sh +++ /dev/null @@ -1,6 +0,0 @@ -date > /etc/vagrant_box_build_time - -mkdir -pm 700 $HOME_DIR/.ssh -curl -L https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -o $HOME_DIR/.ssh/authorized_keys -chmod 0600 $HOME_DIR/.ssh/authorized_keys -chown -R vagrant:vagrant $HOME_DIR/.ssh blob - db57cba1c1808322d2b9cf3304cc736aa92ee8a1 (mode 644) blob + /dev/null --- virtuozzo-6.0/scripts/vmtools.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -eux - -# set a default HOME_DIR environment variable if not set -HOME_DIR="${HOME_DIR:-/home/vagrant}"; - -case "$PACKER_BUILDER_TYPE" in - -virtualbox-iso|virtualbox-ovf) - mkdir -p /tmp/vbox; - ver="`cat $HOME_DIR/.vbox_version`"; - mount -o loop $HOME_DIR/VBoxGuestAdditions_${ver}.iso /tmp/vbox; - sh /tmp/vbox/VBoxLinuxAdditions.run \ - || echo "VBoxLinuxAdditions.run exited $? and is suppressed." \ - "For more read https://www.virtualbox.org/ticket/12479"; - umount /tmp/vbox; - rm -rf /tmp/vbox; - rm -f $HOME_DIR/*.iso; - ;; - -vmware-iso|vmware-vmx) - mkdir -p /tmp/vmfusion; - mkdir -p /tmp/vmfusion-archive; - mount -o loop $HOME_DIR/linux.iso /tmp/vmfusion; - tar xzf /tmp/vmfusion/VMwareTools-*.tar.gz -C /tmp/vmfusion-archive; - /tmp/vmfusion-archive/vmware-tools-distrib/vmware-install.pl --force-install; - umount /tmp/vmfusion; - rm -rf /tmp/vmfusion; - rm -rf /tmp/vmfusion-archive; - rm -f $HOME_DIR/*.iso; - ;; - -parallels-iso|parallels-pvm) - mkdir -p /tmp/parallels; - mount -o loop $HOME_DIR/prl-tools-lin.iso /tmp/parallels; - /tmp/parallels/install --install-unattended-with-deps \ - || (code="$?"; \ - echo "Parallels tools installation exited $code, attempting" \ - "to output /var/log/parallels-tools-install.log"; \ - cat /var/log/parallels-tools-install.log; \ - exit $code); - umount /tmp/parallels; - rm -rf /tmp/parallels; - rm -f $HOME_DIR/*.iso; - ;; -*) - echo "Unknown Packer Builder Type >>$PACKER_BUILDER_TYPE<< selected."; - echo "Known are virtualbox-iso|virtualbox-ovf|vmware-iso|vmware-vmx|parallels-iso|parallels-pvm."; - ;; - -esac blob - eac25473f4182d212ce2cbca5b4bd1cc3841ec36 (mode 644) blob + /dev/null --- virtuozzo-6.0/template.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "provisioners": [ - { - "type": "shell", - "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "environment_vars": [ - "HOME_DIR=/home/vagrant" - ], - "scripts": [ - "scripts/vagrant.sh", - "scripts/vmtools.sh", - "scripts/cleanup.sh", - "scripts/minimize.sh" - ] - } - ], - "post-processors": [ - { - "type": "vagrant", - "output": "virtuozzo-6-0-x64-{{.Provider}}.box" - } - ], - "builders": [ - { - "type": "virtualbox-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "RedHat_64", - "http_directory": "http", - "iso_checksum": "c1b6a97c18a7dec57cfba87043435a36", - "iso_checksum_type": "md5", - "iso_url": "http://updates.cloudserver.odin.com/server/pcs/en_us/parallels/6/update10/parallels-server-6.0.10-3145-x86_64.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", - "virtualbox_version_file": ".vbox_version", - "vboxmanage": [ - [ "modifyvm", "{{.Name}}", "--memory", "1024" ], - [ "modifyvm", "{{.Name}}", "--cpus", "1" ] - ] - }, - { - "type": "vmware-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "centos-64", - "http_directory": "http", - "iso_checksum": "c1b6a97c18a7dec57cfba87043435a36", - "iso_checksum_type": "md5", - "iso_url": "http://updates.cloudserver.odin.com/server/pcs/en_us/parallels/6/update10/parallels-server-6.0.10-3145-x86_64.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "tools_upload_flavor": "linux", - "vmx_data": { - "memsize": "1024", - "numvcpus": "1", - "cpuid.coresPerSocket": "1" - } - }, - { - "type": "parallels-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "psbm", - "http_directory": "http", - "iso_checksum": "c1b6a97c18a7dec57cfba87043435a36", - "iso_checksum_type": "md5", - "iso_url": "http://updates.cloudserver.odin.com/server/pcs/en_us/parallels/6/update10/parallels-server-6.0.10-3145-x86_64.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "parallels_tools_flavor": "lin", - "prlctl": [ - [ "set", "{{.Name}}", "--memsize", "1024" ], - [ "set", "{{.Name}}", "--cpus", "1" ] - ], - "vm_name": "virtuozzo-7.0-x64" - } - ] -} blob - /dev/null blob + 8b9f3e15f70a4b7a16ad7354aedd39a8974f6200 (mode 644) --- /dev/null +++ http/openvz-centos-6.7/ks.cfg @@ -0,0 +1,42 @@ +install +cdrom +lang en_US.UTF-8 +keyboard us +network --onboot yes --device eth0 --bootproto dhcp --noipv6 +rootpw --plaintext vagrant +firewall --enabled --service=ssh +authconfig --enableshadow --passalgo=sha512 +selinux --disabled +timezone Russia/Moscow +bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" + +text +skipx +zerombr + +clearpart --all --initlabel +autopart + +auth --useshadow --enablemd5 +firstboot --disabled +reboot +user --name=vagrant --plaintext --password vagrant + +%packages --ignoremissing +@core +bzip2 +%end + +%post +# Install OpenVZ kernel +curl http://ftp.openvz.org/openvz.repo > /etc/yum.repos.d/OpenVZ.repo +rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ +/usr/bin/yum install -y vzkernel vzctl vzquota ploop + +# Enable conntrack to make ssh work with default iptables configuration +sed -i "s/ip_conntrack_disable_ve0=1/ip_conntrack_disable_ve0=0/" /etc/modprobe.d/openvz.conf + +# sudo +echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant +sed -i "s/^[^#].*requiretty/#Defaults requiretty/" /etc/sudoers +%end blob - /dev/null blob + f8f3bee7e61aae88301ace73b8e77803828e85fa (mode 644) --- /dev/null +++ http/virtuozzo-6.0/ks.cfg @@ -0,0 +1,41 @@ +install +cdrom +lang en_US.UTF-8 +keyboard us +network --onboot yes --device eth0 --bootproto dhcp --noipv6 +rootpw --plaintext vagrant +firewall --enabled --service=ssh +authconfig --enableshadow --passalgo=sha512 +selinux --disabled +timezone Russia/Moscow +bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" + +text +skipx +zerombr + +clearpart --all --initlabel +autopart + +auth --useshadow --enablemd5 +firstboot --disabled +reboot +user --name=vagrant --plaintext --password vagrant + +%packages --ignoremissing +@core +@templates +-iwl*firmware +bzip2 +%end + +%post +# Enable conntrack to make ssh work with default iptables configuration +sed -i "s/ip_conntrack_disable_ve0=1/ip_conntrack_disable_ve0=0/" /etc/modprobe.d/parallels.conf + +# sudo +echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant +sed -i "s/^[^#].*requiretty/#Defaults requiretty/" /etc/sudoers + +echo "ulimit -c unlimited" >> /etc/bashrc +%end blob - /dev/null blob + 3f5c05fd5ee51d431702905662df7642a2d102d4 (mode 644) --- /dev/null +++ http/virtuozzo-7.0/ks.cfg @@ -0,0 +1,47 @@ +install +cdrom +lang en_US.UTF-8 +keyboard us +network --onboot yes --device eth0 --bootproto dhcp --noipv6 +rootpw --plaintext vagrant +firewall --enabled --service=ssh +authconfig --enableshadow --passalgo=sha512 +selinux --disabled +timezone Russia/Moscow +bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" + +text +skipx +zerombr + +clearpart --all --initlabel +autopart + +auth --useshadow --enablemd5 +firstboot --disabled +reboot +user --name=vagrant --plaintext --password vagrant + +%packages --ignoremissing +@core +@templates +-iwl*firmware +virtuozzo-release +bzip2 +%end + +%post +# Install Virtuozzo packages +sed -i "s/^Defaults requiretty/Defaults \!requiretty/" /etc/sudoers +/usr/bin/yum -y group install "Odin Containers" +/usr/bin/yum -y group install "Odin Hypervisor" + +# Enable conntrack to make ssh work with default iptables configuration +sed -i "s/ip_conntrack_disable_ve0=1/ip_conntrack_disable_ve0=0/" /etc/modprobe.d/parallels.conf + +# sudo +echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant +sed -i "s/^[^#].*requiretty/#Defaults requiretty/" /etc/sudoers + +echo "ulimit -c unlimited" >> /etc/bashrc +%end blob - 3f5c05fd5ee51d431702905662df7642a2d102d4 (mode 644) blob + /dev/null --- virtuozzo-7.0/http/ks.cfg +++ /dev/null @@ -1,47 +0,0 @@ -install -cdrom -lang en_US.UTF-8 -keyboard us -network --onboot yes --device eth0 --bootproto dhcp --noipv6 -rootpw --plaintext vagrant -firewall --enabled --service=ssh -authconfig --enableshadow --passalgo=sha512 -selinux --disabled -timezone Russia/Moscow -bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" - -text -skipx -zerombr - -clearpart --all --initlabel -autopart - -auth --useshadow --enablemd5 -firstboot --disabled -reboot -user --name=vagrant --plaintext --password vagrant - -%packages --ignoremissing -@core -@templates --iwl*firmware -virtuozzo-release -bzip2 -%end - -%post -# Install Virtuozzo packages -sed -i "s/^Defaults requiretty/Defaults \!requiretty/" /etc/sudoers -/usr/bin/yum -y group install "Odin Containers" -/usr/bin/yum -y group install "Odin Hypervisor" - -# Enable conntrack to make ssh work with default iptables configuration -sed -i "s/ip_conntrack_disable_ve0=1/ip_conntrack_disable_ve0=0/" /etc/modprobe.d/parallels.conf - -# sudo -echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant -sed -i "s/^[^#].*requiretty/#Defaults requiretty/" /etc/sudoers - -echo "ulimit -c unlimited" >> /etc/bashrc -%end blob - b90ce1faf23ae93696013970985e5549dc3a85c5 (mode 644) blob + /dev/null --- virtuozzo-7.0/scripts/cleanup.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -eux - -# Remove development and kernel source packages -yum -y remove gcc cpp kernel-devel kernel-headers perl libX11 avahi freetype -yum -y clean all - -# Clean up network interface persistence -rm -f /etc/udev/rules.d/70-persistent-net.rules; - -for ndev in `ls -1 /etc/sysconfig/network-scripts/ifcfg-*`; do - if [ "`basename $ndev`" != "ifcfg-lo" ]; then - sed -i '/^HWADDR/d' "$ndev" - sed -i '/^UUID/d' "$ndev" - fi -done blob - 54f1cf169153c9390631be5363a0516e446ce588 (mode 644) blob + /dev/null --- virtuozzo-7.0/scripts/minimize.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -eux -set +e -swapuuid="`/sbin/blkid -o value -l -s UUID -t TYPE=swap`"; -case "$?" in - 2|0) ;; - *) exit 1 ;; -esac -set -e - -if [ "x${swapuuid}" != "x" ]; then - # Whiteout the swap partition to reduce box size - # Swap is disabled till reboot - swappart="`readlink -f /dev/disk/by-uuid/$swapuuid`"; - /sbin/swapoff "$swappart"; - dd if=/dev/zero of="$swappart" bs=1M || echo "dd exit code $? is suppressed"; - /sbin/mkswap -U "$swapuuid" "$swappart"; -fi - -dd if=/dev/zero of=/EMPTY bs=1M || echo "dd exit code $? is suppressed"; -rm -f /EMPTY; -# Block until the empty file has been removed, otherwise, Packer -# will try to kill the box while the disk is still full and that's bad -sync; blob - 9595ed72ca242dba26b0abf517c382b926a1c4a6 (mode 644) blob + /dev/null --- virtuozzo-7.0/scripts/vagrant.sh +++ /dev/null @@ -1,6 +0,0 @@ -date > /etc/vagrant_box_build_time - -mkdir -pm 700 $HOME_DIR/.ssh -curl -L https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -o $HOME_DIR/.ssh/authorized_keys -chmod 0600 $HOME_DIR/.ssh/authorized_keys -chown -R vagrant:vagrant $HOME_DIR/.ssh blob - db57cba1c1808322d2b9cf3304cc736aa92ee8a1 (mode 644) blob + /dev/null --- virtuozzo-7.0/scripts/vmtools.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -eux - -# set a default HOME_DIR environment variable if not set -HOME_DIR="${HOME_DIR:-/home/vagrant}"; - -case "$PACKER_BUILDER_TYPE" in - -virtualbox-iso|virtualbox-ovf) - mkdir -p /tmp/vbox; - ver="`cat $HOME_DIR/.vbox_version`"; - mount -o loop $HOME_DIR/VBoxGuestAdditions_${ver}.iso /tmp/vbox; - sh /tmp/vbox/VBoxLinuxAdditions.run \ - || echo "VBoxLinuxAdditions.run exited $? and is suppressed." \ - "For more read https://www.virtualbox.org/ticket/12479"; - umount /tmp/vbox; - rm -rf /tmp/vbox; - rm -f $HOME_DIR/*.iso; - ;; - -vmware-iso|vmware-vmx) - mkdir -p /tmp/vmfusion; - mkdir -p /tmp/vmfusion-archive; - mount -o loop $HOME_DIR/linux.iso /tmp/vmfusion; - tar xzf /tmp/vmfusion/VMwareTools-*.tar.gz -C /tmp/vmfusion-archive; - /tmp/vmfusion-archive/vmware-tools-distrib/vmware-install.pl --force-install; - umount /tmp/vmfusion; - rm -rf /tmp/vmfusion; - rm -rf /tmp/vmfusion-archive; - rm -f $HOME_DIR/*.iso; - ;; - -parallels-iso|parallels-pvm) - mkdir -p /tmp/parallels; - mount -o loop $HOME_DIR/prl-tools-lin.iso /tmp/parallels; - /tmp/parallels/install --install-unattended-with-deps \ - || (code="$?"; \ - echo "Parallels tools installation exited $code, attempting" \ - "to output /var/log/parallels-tools-install.log"; \ - cat /var/log/parallels-tools-install.log; \ - exit $code); - umount /tmp/parallels; - rm -rf /tmp/parallels; - rm -f $HOME_DIR/*.iso; - ;; -*) - echo "Unknown Packer Builder Type >>$PACKER_BUILDER_TYPE<< selected."; - echo "Known are virtualbox-iso|virtualbox-ovf|vmware-iso|vmware-vmx|parallels-iso|parallels-pvm."; - ;; - -esac blob - a81b9ef2a26928e5af4f51f2101573e7d1c77834 (mode 644) blob + /dev/null --- virtuozzo-7.0/template.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "provisioners": [ - { - "type": "shell", - "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'", - "environment_vars": [ - "HOME_DIR=/home/vagrant" - ], - "scripts": [ - "scripts/vagrant.sh", - "scripts/vmtools.sh", - "scripts/cleanup.sh", - "scripts/minimize.sh" - ] - } - ], - "post-processors": [ - { - "type": "vagrant", - "output": "virtuozzo-7-0-x64-{{.Provider}}.box" - } - ], - "builders": [ - { - "type": "virtualbox-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "RedHat_64", - "http_directory": "http", - "iso_checksum": "a1c3501cd751177f1c0a96f68ca8c128a89d420ab8cf0ee4f69490de9892ccb7", - "iso_checksum_type": "sha256", - "iso_url": "http://mirror.yandex.ru/mirrors/download.openvz.org/virtuozzo/factory/x86_64/iso/VZ-7.0.0-1165-x86_64-DVD.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", - "virtualbox_version_file": ".vbox_version", - "vboxmanage": [ - [ "modifyvm", "{{.Name}}", "--memory", "512" ], - [ "modifyvm", "{{.Name}}", "--cpus", "1" ] - ] - }, - { - "type": "vmware-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "centos-64", - "http_directory": "http", - "iso_checksum": "a1c3501cd751177f1c0a96f68ca8c128a89d420ab8cf0ee4f69490de9892ccb7", - "iso_checksum_type": "sha256", - "iso_url": "http://mirror.yandex.ru/mirrors/download.openvz.org/virtuozzo/factory/x86_64/iso/VZ-7.0.0-1165-x86_64-DVD.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "tools_upload_flavor": "linux", - "vmx_data": { - "memsize": "512", - "numvcpus": "1", - "cpuid.coresPerSocket": "1" - } - }, - { - "type": "parallels-iso", - "boot_command": [ - " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg" - ], - "boot_wait": "10s", - "disk_size": 40520, - "guest_os_type": "psbm", - "http_directory": "http", - "iso_checksum": "a1c3501cd751177f1c0a96f68ca8c128a89d420ab8cf0ee4f69490de9892ccb7", - "iso_checksum_type": "sha256", - "iso_url": "http://mirror.yandex.ru/mirrors/download.openvz.org/virtuozzo/factory/x86_64/iso/VZ-7.0.0-1165-x86_64-DVD.iso", - "ssh_username": "vagrant", - "ssh_password": "vagrant", - "ssh_port": 22, - "ssh_wait_timeout": "10000s", - "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", - "parallels_tools_flavor": "lin", - "prlctl": [ - [ "set", "{{.Name}}", "--memsize", "512" ], - [ "set", "{{.Name}}", "--cpus", "1" ] - ], - "vm_name": "virtuozzo-7.0-x64" - } - ] -} blob - /dev/null blob + a0030686b61f847cb37737e342776f74941d2be0 (mode 644) --- /dev/null +++ openvz-centos-6.7.json @@ -0,0 +1,111 @@ +{ + "provisioners": [ + { + "type": "shell", + "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'", + "environment_vars": [ + "HOME_DIR=/home/vagrant" + ], + "scripts": [ + "scripts/sshd.sh", + "scripts/networking.sh", + "scripts/vagrant.sh", + "scripts/vmtools.sh", + "scripts/cleanup.sh", + "scripts/minimize.sh" + ] + } + ], + "post-processors": [ + { + "type": "vagrant", + "output": "builds/openvz-centos-6.7-x64-{{.Provider}}.box" + } + ], + "builders": [ + { + "type": "virtualbox-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "RedHat_64", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", + "virtualbox_version_file": ".vbox_version", + "vboxmanage": [ + [ "modifyvm", "{{.Name}}", "--memory", "512" ], + [ "modifyvm", "{{.Name}}", "--cpus", "1" ] + ], + "vm_name": "{{user `template`}}" + }, + { + "type": "vmware-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "RedHat_64", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "tools_upload_flavor": "linux", + "vm_name": "{{user `template`}}", + "vmx_data": { + "memsize": "512", + "numvcpus": "1", + "cpuid.coresPerSocket": "1" + } + }, + { + "type": "parallels-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "rhel", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "parallels_tools_flavor": "lin", + "prlctl": [ + [ "set", "{{.Name}}", "--memsize", "512" ], + [ "set", "{{.Name}}", "--cpus", "1" ] + ], + "vm_name": "{{user `template`}}" + } + ], + "variables": { + "iso_checksum": "9d3fec5897be6b3fed4d3dda80b8fa7bb62c616bbfd4bdcd27295ca9b764f498", + "iso_checksum_type": "sha256", + "iso_url": "http://mirror.yandex.ru/centos/6.7/isos/x86_64/CentOS-6.7-x86_64-minimal.iso", + "ks_path": "openvz-centos-6.7/ks.cfg", + "template": "openvz-centos-6.7-x64" + } +} blob - /dev/null blob + b90ce1faf23ae93696013970985e5549dc3a85c5 (mode 644) --- /dev/null +++ scripts/cleanup.sh @@ -0,0 +1,15 @@ +#!/bin/sh -eux + +# Remove development and kernel source packages +yum -y remove gcc cpp kernel-devel kernel-headers perl libX11 avahi freetype +yum -y clean all + +# Clean up network interface persistence +rm -f /etc/udev/rules.d/70-persistent-net.rules; + +for ndev in `ls -1 /etc/sysconfig/network-scripts/ifcfg-*`; do + if [ "`basename $ndev`" != "ifcfg-lo" ]; then + sed -i '/^HWADDR/d' "$ndev" + sed -i '/^UUID/d' "$ndev" + fi +done blob - /dev/null blob + 54f1cf169153c9390631be5363a0516e446ce588 (mode 644) --- /dev/null +++ scripts/minimize.sh @@ -0,0 +1,23 @@ +#!/bin/sh -eux +set +e +swapuuid="`/sbin/blkid -o value -l -s UUID -t TYPE=swap`"; +case "$?" in + 2|0) ;; + *) exit 1 ;; +esac +set -e + +if [ "x${swapuuid}" != "x" ]; then + # Whiteout the swap partition to reduce box size + # Swap is disabled till reboot + swappart="`readlink -f /dev/disk/by-uuid/$swapuuid`"; + /sbin/swapoff "$swappart"; + dd if=/dev/zero of="$swappart" bs=1M || echo "dd exit code $? is suppressed"; + /sbin/mkswap -U "$swapuuid" "$swappart"; +fi + +dd if=/dev/zero of=/EMPTY bs=1M || echo "dd exit code $? is suppressed"; +rm -f /EMPTY; +# Block until the empty file has been removed, otherwise, Packer +# will try to kill the box while the disk is still full and that's bad +sync; blob - /dev/null blob + e61cf35021c420f624427f1421f127381df422f7 (mode 644) --- /dev/null +++ scripts/networking.sh @@ -0,0 +1,19 @@ +#!/bin/sh -eux + +case "$PACKER_BUILDER_TYPE" in + +virtualbox-iso|virtualbox-ovf) + major_version="`sed 's/^.\+ release \([.0-9]\+\).*/\1/' /etc/redhat-release | awk -F. '{print $1}'`"; + + if [ "$major_version" -ge 6 ]; then + # Fix slow DNS: + # Add 'single-request-reopen' so it is included when /etc/resolv.conf is + # generated + # https://access.redhat.com/site/solutions/58625 (subscription required) + echo 'RES_OPTIONS="single-request-reopen"' >>/etc/sysconfig/network; + service network restart; + echo 'Slow DNS fix applied (single-request-reopen)'; + fi + ;; + +esac blob - /dev/null blob + 1bb16f56e24be7499222ca975199f50d8e9e0fad (mode 644) --- /dev/null +++ scripts/sshd.sh @@ -0,0 +1,20 @@ +#!/bin/sh -eux + +SSHD_CONFIG="/etc/ssh/sshd_config" + +# ensure that there is a trailing newline before attempting to concatenate +sed -i -e '$a\' "$SSHD_CONFIG" + +USEDNS="UseDNS no" +if grep -q -E "^[[:space:]]*UseDNS" "$SSHD_CONFIG"; then + sed -i "s/^\s*UseDNS.*/${USEDNS}/" "$SSHD_CONFIG" +else + echo "$USEDNS" >>"$SSHD_CONFIG" +fi + +GSSAPI="GSSAPIAuthentication no" +if grep -q -E "^[[:space:]]*GSSAPIAuthentication" "$SSHD_CONFIG"; then + sed -i "s/^\s*GSSAPIAuthentication.*/${GSSAPI}/" "$SSHD_CONFIG" +else + echo "$GSSAPI" >>"$SSHD_CONFIG" +fi blob - /dev/null blob + 04b3aab268fa00f6f474362b68cc342f309c9a12 (mode 644) --- /dev/null +++ scripts/vagrant.sh @@ -0,0 +1,19 @@ +#!/bin/sh -eux + +# set a default HOME_DIR environment variable if not set +HOME_DIR="${HOME_DIR:-/home/vagrant}"; + +pubkey_url="https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub"; +mkdir -p $HOME_DIR/.ssh; +if command -v wget >/dev/null 2>&1; then + wget --no-check-certificate "$pubkey_url" -O $HOME_DIR/.ssh/authorized_keys; +elif command -v curl >/dev/null 2>&1; then + curl --insecure --location "$pubkey_url" > $HOME_DIR/.ssh/authorized_keys; +elif command -v fetch >/dev/null 2>&1; then + fetch -am -o $HOME_DIR/.ssh/authorized_keys "$pubkey_url"; +else + echo "Cannot download vagrant public key"; + exit 1; +fi +chown -R vagrant:vagrant $HOME_DIR/.ssh; +chmod -R go-rwsx $HOME_DIR/.ssh; blob - /dev/null blob + db57cba1c1808322d2b9cf3304cc736aa92ee8a1 (mode 644) --- /dev/null +++ scripts/vmtools.sh @@ -0,0 +1,50 @@ +#!/bin/sh -eux + +# set a default HOME_DIR environment variable if not set +HOME_DIR="${HOME_DIR:-/home/vagrant}"; + +case "$PACKER_BUILDER_TYPE" in + +virtualbox-iso|virtualbox-ovf) + mkdir -p /tmp/vbox; + ver="`cat $HOME_DIR/.vbox_version`"; + mount -o loop $HOME_DIR/VBoxGuestAdditions_${ver}.iso /tmp/vbox; + sh /tmp/vbox/VBoxLinuxAdditions.run \ + || echo "VBoxLinuxAdditions.run exited $? and is suppressed." \ + "For more read https://www.virtualbox.org/ticket/12479"; + umount /tmp/vbox; + rm -rf /tmp/vbox; + rm -f $HOME_DIR/*.iso; + ;; + +vmware-iso|vmware-vmx) + mkdir -p /tmp/vmfusion; + mkdir -p /tmp/vmfusion-archive; + mount -o loop $HOME_DIR/linux.iso /tmp/vmfusion; + tar xzf /tmp/vmfusion/VMwareTools-*.tar.gz -C /tmp/vmfusion-archive; + /tmp/vmfusion-archive/vmware-tools-distrib/vmware-install.pl --force-install; + umount /tmp/vmfusion; + rm -rf /tmp/vmfusion; + rm -rf /tmp/vmfusion-archive; + rm -f $HOME_DIR/*.iso; + ;; + +parallels-iso|parallels-pvm) + mkdir -p /tmp/parallels; + mount -o loop $HOME_DIR/prl-tools-lin.iso /tmp/parallels; + /tmp/parallels/install --install-unattended-with-deps \ + || (code="$?"; \ + echo "Parallels tools installation exited $code, attempting" \ + "to output /var/log/parallels-tools-install.log"; \ + cat /var/log/parallels-tools-install.log; \ + exit $code); + umount /tmp/parallels; + rm -rf /tmp/parallels; + rm -f $HOME_DIR/*.iso; + ;; +*) + echo "Unknown Packer Builder Type >>$PACKER_BUILDER_TYPE<< selected."; + echo "Known are virtualbox-iso|virtualbox-ovf|vmware-iso|vmware-vmx|parallels-iso|parallels-pvm."; + ;; + +esac blob - /dev/null blob + a4c301da4397c6addadfdabb81c7a96e7bce5708 (mode 644) --- /dev/null +++ virtuozzo-6.0.json @@ -0,0 +1,111 @@ +{ + "provisioners": [ + { + "type": "shell", + "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'", + "environment_vars": [ + "HOME_DIR=/home/vagrant" + ], + "scripts": [ + "scripts/sshd.sh", + "scripts/networking.sh", + "scripts/vagrant.sh", + "scripts/vmtools.sh", + "scripts/cleanup.sh", + "scripts/minimize.sh" + ] + } + ], + "post-processors": [ + { + "type": "vagrant", + "output": "builds/virtuozzo-6-0-x64-{{.Provider}}.box" + } + ], + "builders": [ + { + "type": "virtualbox-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "RedHat_64", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", + "virtualbox_version_file": ".vbox_version", + "vboxmanage": [ + [ "modifyvm", "{{.Name}}", "--memory", "1024" ], + [ "modifyvm", "{{.Name}}", "--cpus", "1" ] + ], + "vm_name": "{{user `template`}}" + }, + { + "type": "vmware-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "centos-64", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "tools_upload_flavor": "linux", + "vm_name": "{{user `template`}}", + "vmx_data": { + "memsize": "1024", + "numvcpus": "1", + "cpuid.coresPerSocket": "1" + } + }, + { + "type": "parallels-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "psbm", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "parallels_tools_flavor": "lin", + "prlctl": [ + [ "set", "{{.Name}}", "--memsize", "1024" ], + [ "set", "{{.Name}}", "--cpus", "1" ] + ], + "vm_name": "{{user `template`}}" + } + ], + "variables": { + "iso_checksum": "c1b6a97c18a7dec57cfba87043435a36", + "iso_checksum_type": "md5", + "iso_url": "http://updates.cloudserver.odin.com/server/pcs/en_us/parallels/6/update10/parallels-server-6.0.10-3145-x86_64.iso", + "ks_path": "virtuozzo-6.0/ks.cfg", + "template": "virtuozzo-6.0-x64" + } +} blob - /dev/null blob + 6204bbee48f7c9fce9f7d8f3dd623bd3d0efc71c (mode 644) --- /dev/null +++ virtuozzo-7.0.json @@ -0,0 +1,111 @@ +{ + "provisioners": [ + { + "type": "shell", + "execute_command": "echo 'vagrant' | {{.Vars}} sudo -E -S bash '{{.Path}}'", + "environment_vars": [ + "HOME_DIR=/home/vagrant" + ], + "scripts": [ + "scripts/sshd.sh", + "scripts/networking.sh", + "scripts/vagrant.sh", + "scripts/vmtools.sh", + "scripts/cleanup.sh", + "scripts/minimize.sh" + ] + } + ], + "post-processors": [ + { + "type": "vagrant", + "output": "builds/virtuozzo-7-0-x64-{{.Provider}}.box" + } + ], + "builders": [ + { + "type": "virtualbox-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "RedHat_64", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", + "virtualbox_version_file": ".vbox_version", + "vboxmanage": [ + [ "modifyvm", "{{.Name}}", "--memory", "512" ], + [ "modifyvm", "{{.Name}}", "--cpus", "1" ] + ], + "vm_name": "{{user `template`}}" + }, + { + "type": "vmware-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "centos-64", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "tools_upload_flavor": "linux", + "vm_name": "{{user `template`}}", + "vmx_data": { + "memsize": "512", + "numvcpus": "1", + "cpuid.coresPerSocket": "1" + } + }, + { + "type": "parallels-iso", + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/{{user `ks_path`}}" + ], + "boot_wait": "10s", + "disk_size": 40520, + "guest_os_type": "psbm", + "http_directory": "http", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + "iso_url": "{{user `iso_url`}}", + "output_directory": "packer-{{user `template`}}-{{.Provider}}", + "ssh_username": "vagrant", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_wait_timeout": "10000s", + "shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant'|sudo -S sh '/tmp/shutdown.sh'", + "parallels_tools_flavor": "lin", + "prlctl": [ + [ "set", "{{.Name}}", "--memsize", "512" ], + [ "set", "{{.Name}}", "--cpus", "1" ] + ], + "vm_name": "{{user `template`}}" + } + ], + "variables": { + "iso_checksum": "4cfa5af65197e28178f2aa158a0b60fba93e4ad0d81ccecbe5ddf899ff5624a9", + "iso_checksum_type": "sha256", + "iso_url": "https://download.openvz.org/virtuozzo/releases/7.0-beta1/x86_64/iso/VZ-7.0.0-495-x86_64-DVD.iso", + "ks_path": "virtuozzo-7.0/ks.cfg", + "template": "virtuozzo-7.0-x64" + } +}