{ "builders": [ { "type": "qemu", "accelerator": "kvm", "headless": true, "qemuargs": [ ["-serial", "file:serial.out" ], [ "-netdev", "user,hostfwd=tcp::{{ .SSHHostPort }}-:22,,hostfwd=tcp::5959-:{{ . }},id=forward"] ], "memory": "1g", "cpus": "2", "disk_interface": "virtio", "disk_size": "5000M", "disk_image": "true", "use_backing_file": "true", "format": "qcow2", "net_device": "virtio-net", "iso_url": "http://ftp.uni-stuttgart.de/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso", "iso_checksum": "9bea61ff620257c3343eb3c588c555800488ace01602b7a0e4f89d09a3f976851a81b6501d79cb3696696675b4724c9da82913e4a036f7874a55bfe2b91ee994", "iso_checksum_type": "sha512", "vm_name": "gentoo_packer", "output_directory": "output_gentoo_qcow2", "http_directory": "/packer/httpdir", "http_port_min": 10082, "http_port_max": 10089, "ssh_host_port_min": 2222, "ssh_host_port_max": 2229, "ssh_username": "root", "ssh_password": "MySecretPassword", "ssh_port": 22, "ssh_wait_timeout": "900m", "boot_wait": "5s", "boot_command": [ "", "text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/provision_gentoo.sh", "chmod +x provision_gentoo.sh && ./provision_gentoo.sh" ], "shutdown_command": "shutdown -P now" }, { "type": "hyperv-iso", "boot_command": [ "", "", "", "", "", "wget http://{{ .HTTPIP }}:{{ .HTTPPort }}/provision_gentoo.sh", "echo http://{{ .HTTPIP }}:{{ .HTTPPort }} > /root/config_server_uri", "chmod +x provision_gentoo.sh && ./provision_gentoo.sh", "", " append console=ttyS0,115200n8 ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos6-ks.cfg", "", "", "text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/c7-kvm-ks.cfg" ], "boot_wait": "10s", "disk_size": 32768, "http_directory": ".", "iso_url": "http://vagrant.widgit.com/gentoo.php", "iso_checksum_type": "none", "communicator": "ssh", "ssh_username": "vagrant", "ssh_password": "vagrant", "ssh_port": 22, "ssh_timeout": "4h", "shutdown_command": "sudo systemctl poweroff", "vm_name": "gentoo-minimal", "generation": 1, "ram_size": "4096", "enable_dynamic_memory": false, "cpu": 4 } ], "provisioners": [ { "type": "shell", "inline": [ "sleep 3", "rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm", "yum -y update", "yum -y install cloud-init cloud-utils-growpart dracut-modules-growroot", "echo \"NOZEROCONF=yes\" >> /etc/sysconfig/network", "adduser build-user", "echo 'build-user:MySecretPassword' |chpasswd", "mkdir /home/build-user/.ssh", "chown build-user:build-user /home/build-user/.ssh", "chmod 700 /home/build-user/.ssh", "echo \"build-user ALL=(ALL) ALL\" >> /etc/sudoers", "yum clean cache", "yum clean all" ] }, { "type": "file", "source": "centos.json", "destination": "/root/centos.json", "source": "httpdir/centos6-ks.cfg", "destination": "/root/centos6-ks.cfg" }, { "type": "file", "source": "id_rsa_cloud-user.pub", "destination": "/home/build-user/.ssh/authorized_keys" }, { "type": "shell", "inline": [ "chmod 600 /home/build-user/.ssh/authorized_keys", "chown build-user:build-user /home/build-user/.ssh/authorized_keys", "sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config", "echo package_upgrade: true >>/etc/cloud/cloud.cfg" ] }, { "type": "file", "source": "/packer/id_rsa_qemu.pub", "destination": "/root/.ssh/authorized_keys" }, { "type": "shell", "inline": [ "chown root:root /root/.ssh/authorized_keys", "chmod 600 /root/.ssh/authorized_keys", "sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config", "echo package_upgrade: true >>/etc/cloud/cloud.cfg" ] } ] }