root@landrew:/home/msh/packer# less centos7-packer0.json
{
"builders":
[
{
"type": "qemu",
"iso_url": "http://ns1.plz.yo/iso/centos/CentOS-7.0-1406-x86_64-Minimal.iso",
"iso_checksum": "e3afe3f1121d69c40cc23f0bafa05e5d",
"iso_checksum_type": "md5",
"output_directory": "/store0/libvirt/pools/default/packerd-fudge",
"ssh_wait_timeout": "30s",
"shutdown_command": "shutdown -P now",
"disk_size": 1600,
"format": "qcow2",
"headless": true,
"accelerator": "kvm",
"http_directory": "httpdir",
"http_port_min": 10082,
"http_port_max": 10089,
"ssh_host_port_min": 33000,
"ssh_host_port_max": 33654,
"ssh_username": "msh",
"ssh_password": "p4sSw3rdZ",
"ssh_port": 22,
"ssh_wait_timeout": "90m",
"vm_name": "plz-test0",
"net_device": "virtio-net",
"disk_interface": "virtio",
"boot_wait": "5s",
"boot_command":
[
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/kickstart/centos7ks.cfg<enter><wait>"
]
}
]
}
install
lang en_US.UTF-8
keyboard us
network --bootproto=dhcp --device=eth0 --gateway=192.168.10.1 --hostname=centos7 --nameserver=192.168.10.1
# packages location
url --url=http://ns1.plz.yo/iso/centos/CentOS-7.0-1406-x86_64-Minimal.iso
rootpw --iscrypted shG2ReAKHuU1M
# where password above is created with "python -c 'import crypt; print(crypt.crypt("mypassword", "sha256sum"))'"
# one may alter "mypassword" and sha256sum ( valid are md5sum sha1sum sha224sum sha256sum sha384sum sha512sum shasum )
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
selinux --enforcing
timezone --utc Etc/UTC
bootloader --location=mbr
#disk part
clearpart --all --initlabel
part / --fstype=xfs --asprimary --size=8000
part /var --fstype=xfs --size=4000
part /boot --fstype=ext4 --size=200
part swap --size=300 --asprimary
# packages we want to install, in my case I do minimal installation due to speed
%packages
@base
@core
chrony
createrepo
%end
2015/04/25 19:54:24 packer-builder-qemu: 2015/04/25 19:54:24 Attempting SSH connection...
2015/04/25 19:54:24 packer-builder-qemu: 2015/04/25 19:54:24 reconnecting to TCP connection for SSH
2015/04/25 19:54:24 packer-builder-qemu: 2015/04/25 19:54:24 handshaking with SSH
2015/04/25 19:54:43 packer-builder-qemu: 2015/04/25 19:54:43 handshake error: ssh: handshake failed: read tcp 127.0
.0.1:33615: connection reset by peer
2015/04/25 19:54:43 packer-builder-qemu: 2015/04/25 19:54:43 SSH handshake err: ssh: handshake failed: read tcp 127
.0.0.1:33615: connection reset by peer