Skip to content

Instantly share code, notes, and snippets.

@isa
Forked from filler/README.md
Last active December 11, 2015 07:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save isa/4568732 to your computer and use it in GitHub Desktop.
Save isa/4568732 to your computer and use it in GitHub Desktop.

RHEL 6.3 veewee templates for vagrant use

These templates can be used to feed to veewee to spin up an el6 basebox for use with vagrant.

There are some coded values in definition.rb and ks.cfg which point at Yale-ishness. Amend to point at local RHEL iso/yum repo.

Built successfully with veewee 0.2.3, vagrant 1.0.3, Virtualbox 4.1.18.

Config Management

  • chef via gem install
  • puppet via puppetlabs repo
  • cfengine3 via cfengine repo

Use this

$ git clone git://gist.github.com/3091190.git definitions/RHEL-6.3-x86_64`
$ vagrant basebox build 'RHEL-6.3-x86_64'

It works

[vagrant@localhost ~]$ chef-solo --version
Chef: 10.12.0
[vagrant@localhost ~]$ puppet --version
2.7.18
[vagrant@localhost ~]$ cf-agent -V

   @@@      
   @@@      cf-agent
            
 @ @@@ @    CFEngine Core 3.3.4
 @ @@@ @    
 @ @@@ @    
 @     @    
   @@@      
   @ @      
   @ @      
   @ @      

Copyright (C) CFEngine AS 2008-2012
See Licensing at http://cfengine.com/3rdpartylicenses
[vagrant@localhost ~]$ 
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '512',
:disk_size => '102400', :disk_format => 'VDI', :hostiocache => 'off', :ioapic => 'on', :pae => 'on',
:os_type_id => 'RedHat_64',
:iso_file => "rhel-server-6.3-x86_64-boot.iso",
:iso_src => "http://rhnproxy1.uvm.edu/pub/redhat/rhel6-x86_64/isos/rhel-server-6.3-x86_64-boot.iso",
:iso_md5 => "793c3e3f2ba604fe3f220871345d0956",
:iso_download_timeout => 1000,
:boot_wait => "15", :boot_cmd_sequence => [ '<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>' ],
:kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
:ssh_login_timeout => "100", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
:shutdown_cmd => "/sbin/halt -h -p",
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
})
install
url --url=http://rhnproxy1.uvm.edu/pub/redhat/rhel6-x86_64/install/
lang en_US.UTF-8
keyboard us
network --bootproto dhcp
rootpw --iscrypted $1$damlkd,f$UC/u5pUts5QiU3ow.CSso/
firewall --enabled --trust eth0 --ssh
authconfig --enableshadow --enablemd5
selinux --disabled
timezone America/EST
bootloader --location=mbr
text
skipx
zerombr
clearpart --all --initlabel
autopart
auth --useshadow --enablemd5
firstboot --disabled
reboot
%packages
#@ core
kernel-devel
gcc
gcc-c++
bzip2
make
zlib-devel
openssl-devel
readline-devel
sqlite-devel
-ipw2100-firmware
-ipw2200-firmware
-ivtv-firmware
%post
/usr/sbin/groupadd vagrant
/usr/sbin/useradd vagrant -g vagrant -G wheel
echo "vagrant"|passwd --stdin vagrant
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant
#http://chrisadams.me.uk/2010/05/10/setting-up-a-centos-base-box-for-development-and-testing-with-vagrant/
date > /etc/vagrant_box_build_time
cat > /etc/yum.repos.d/puppetlabs.repo << EOM
[puppetlabs]
name=puppetlabs
baseurl=http://yum.puppetlabs.com/el/6/products/\$basearch
enabled=0
gpgcheck=0
EOM
cat > /etc/yum.repos.d/epel.repo << EOM
[epel]
name=epel
baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
enabled=0
gpgcheck=0
EOM
cat > /etc/yum.repos.d/cfengine.repo << EOM
[cfengine]
name=cfengine
baseurl=http://cfengine.com/pub/yum/
enabled=0
gpgcheck=0
EOM
cat > /etc/yum.repos.d/rhel.repo << EOM
[rhel]
name=rhel
baseurl=http://pkg.its.yale.edu/redhat/6.3/\$basearch
enabled=1
gpgcheck=0
EOM
cat > /etc/yum.repos.d/yale.repo << EOM
[yale]
name=yale
baseurl=http://pkg.its.yale.edu/yale/
enabled=1
gpgcheck=0
EOM
# puppet
yum -y --enablerepo=epel,puppetlabs install puppet facter ruby-devel rubygems
yum -y erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts
yum -y clean all
# cfengine
yum -y --enablerepo=cfengine install cfengine-community
yum -y clean all
# chef
gem install --no-ri --no-rdoc chef
# Installing vagrant keys
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
chown -R vagrant /home/vagrant/.ssh
# Installing the virtualbox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
cd /tmp
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt
rm VBoxGuestAdditions_$VBOX_VERSION.iso
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
dd if=/dev/zero of=/tmp/clean || rm /tmp/clean
/sbin/chkconfig iptables off
exit
@isa
Copy link
Author

isa commented Jan 18, 2013

Updated the proxies for RHEL isos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment