From 84fb194cf01e1499652b975582b1d31554680d95 Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Thu, 3 Apr 2014 00:14:17 -0400 Subject: [PATCH] Support Red Hat Enterprise Linux 7 Release Candidate. --- packer/http/centos-7.0/ks.cfg | 73 ++++++++++++++++++++++++ packer/rhel-7.0-x86_64.json | 95 ++++++++++++++++++++++++++++++++ packer/scripts/centos/cleanup.sh | 6 +- 3 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 packer/http/centos-7.0/ks.cfg create mode 100644 packer/rhel-7.0-x86_64.json diff --git a/packer/http/centos-7.0/ks.cfg b/packer/http/centos-7.0/ks.cfg new file mode 100644 index 000000000..f69a26f70 --- /dev/null +++ b/packer/http/centos-7.0/ks.cfg @@ -0,0 +1,73 @@ +install +cdrom +lang en_US.UTF-8 +keyboard us +network --bootproto=dhcp +rootpw vagrant +firewall --disabled +selinux --permissive +timezone UTC +unsupported_hardware +bootloader --location=mbr +text +skipx +zerombr +clearpart --all --initlabel +autopart +auth --enableshadow --passalgo=sha512 --kickstart +firstboot --disabled +reboot +user --name=vagrant --plaintext --password vagrant + +%packages --nobase --ignoremissing --excludedocs +# vagrant needs this to copy initial files via scp +openssh-clients +sudo +kernel-headers +kernel-devel +gcc +make +perl +curl +wget +nfs-utils +bzip2 +-fprintd-pam +-intltool + +# unnecessary firmware +-aic94xx-firmware +-atmel-firmware +-b43-openfwwf +-bfa-firmware +-ipw2100-firmware +-ipw2200-firmware +-ivtv-firmware +-iwl100-firmware +-iwl1000-firmware +-iwl3945-firmware +-iwl4965-firmware +-iwl5000-firmware +-iwl5150-firmware +-iwl6000-firmware +-iwl6000g2a-firmware +-iwl6050-firmware +-libertas-usb8388-firmware +-ql2100-firmware +-ql2200-firmware +-ql23xx-firmware +-ql2400-firmware +-ql2500-firmware +-rt61pci-firmware +-rt73usb-firmware +-xorg-x11-drv-ati-firmware +-zd1211-firmware +%end + +%post +# update root certs +wget -O/etc/pki/tls/certs/ca-bundle.crt http://curl.haxx.se/ca/cacert.pem +# sudo +echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant +sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers +%end diff --git a/packer/rhel-7.0-x86_64.json b/packer/rhel-7.0-x86_64.json new file mode 100644 index 000000000..fc7cba27d --- /dev/null +++ b/packer/rhel-7.0-x86_64.json @@ -0,0 +1,95 @@ +{ + "builders": [ + { + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos-7.0/ks.cfg" + ], + "boot_wait": "10s", + "disk_size": 40960, + "guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", + "guest_os_type": "RedHat_64", + "http_directory": "http", + "iso_checksum": "bea5e951342a7ab0233219c3deb3b3acff023ea5dc67a9a4564a97a89364f192", + "iso_checksum_type": "sha256", + "iso_url": "{{user `mirror`}}/rc/7/Server/x86_64/iso/rhel-server-7.0-x86_64-dvd.iso", + "output_directory": "packer-rhel-7.0-x86_64-virtualbox", + "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "type": "virtualbox-iso", + "vboxmanage": [ + [ + "modifyvm", + "{{.Name}}", + "--memory", + "480" + ], + [ + "modifyvm", + "{{.Name}}", + "--cpus", + "1" + ] + ], + "virtualbox_version_file": ".vbox_version", + "vm_name": "packer-centos-7.0-x86_64" + }, + { + "boot_command": [ + " text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel-7.0/ks.cfg" + ], + "boot_wait": "10s", + "disk_size": 40960, + "guest_os_type": "redhat-64", + "http_directory": "http", + "iso_checksum": "bea5e951342a7ab0233219c3deb3b3acff023ea5dc67a9a4564a97a89364f192", + "iso_checksum_type": "sha256", + "iso_url": "{{user `mirror`}}/rc/7/Server/x86_64/iso/rhel-server-7.0-x86_64-dvd.iso", + "output_directory": "packer-rhel-7.0-x86_64-vmware", + "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p", + "ssh_password": "vagrant", + "ssh_port": 22, + "ssh_username": "vagrant", + "ssh_wait_timeout": "10000s", + "tools_upload_flavor": "linux", + "type": "vmware-iso", + "vm_name": "packer-centos-7.0-x86_64", + "vmx_data": { + "cpuid.coresPerSocket": "1", + "memsize": "480", + "numvcpus": "1" + } + } + ], + "post-processors": [ + { + "output": "../builds/{{.Provider}}/opscode_rhel-7.0_chef-{{user `chef_version`}}.box", + "type": "vagrant" + } + ], + "provisioners": [ + { + "environment_vars": [ + "CHEF_VERSION={{user `chef_version`}}" + ], + "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'", + "scripts": [ + "scripts/centos/fix-slow-dns.sh", + "scripts/common/sshd.sh", + "scripts/common/vagrant.sh", + "scripts/common/vmtools.sh", + "scripts/common/chef.sh", + "scripts/centos/cleanup.sh", + "scripts/common/minimize.sh" + ], + "type": "shell" + } + ], + "variables": { + "chef_version": "provisionerless", + "mirror": "http://ftp.redhat.com/redhat/rhel" + } +} + diff --git a/packer/scripts/centos/cleanup.sh b/packer/scripts/centos/cleanup.sh index 4dfe958bc..63374115d 100644 --- a/packer/scripts/centos/cleanup.sh +++ b/packer/scripts/centos/cleanup.sh @@ -7,5 +7,7 @@ rm -f /tmp/chef*rpm # clean up redhat interface persistence rm -f /etc/udev/rules.d/70-persistent-net.rules -sed -i 's/^HWADDR.*$//' /etc/sysconfig/network-scripts/ifcfg-eth0 -sed -i 's/^UUID.*$//' /etc/sysconfig/network-scripts/ifcfg-eth0 +if [ -r /etc/sysconfig/network-scripts/ifcfg-eth0 ]; then + sed -i 's/^HWADDR.*$//' /etc/sysconfig/network-scripts/ifcfg-eth0 + sed -i 's/^UUID.*$//' /etc/sysconfig/network-scripts/ifcfg-eth0 +fi