-
-
Save erikverstegen/19313f554f3d0c230c31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// box.json | |
{ | |
"builders": [ | |
{ | |
"iso_checksum_type": "sha256", | |
"iso_checksum": "f90e4d28fa377669b2db16cbcb451fcb9a89d2460e3645993e30e137ac37d284", | |
"iso_url": "http://linux.cs.uu.nl/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1511.iso", | |
"ssh_wait_timeout": "10000s", | |
"ssh_username": "vagrant", | |
"ssh_password": "vagrant", | |
"ssh_port": 22, | |
"shutdown_command": "echo '/sbin/halt -h -p' > /tmp/shutdown.sh; echo 'vagrant' | sudo -S sh '/tmp/shutdown.sh'", | |
"boot_command": [ | |
"<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/kickstart.cfg<enter><wait>" | |
], | |
"boot_wait": "10s", | |
"disk_size": 40960, | |
"virtualbox_version_file": ".vbox_version", | |
"guest_additions_path": "VBoxGuestAdditions_{{.Version}}.iso", | |
"http_directory": "http", | |
"guest_os_type": "RedHat_64", | |
"type": "virtualbox-iso" | |
} | |
], | |
"provisioners": [ | |
{ | |
"execute_command": "echo 'vagrant' | sudo -S sh '{{.Path}}'", | |
"scripts": [ | |
"scripts/base.sh", | |
"scripts/vagrant.sh", | |
"scripts/virtualbox.sh", | |
"scripts/cleanup.sh", | |
"scripts/puppet.sh" | |
], | |
"type": "shell" | |
} | |
], | |
"post-processors": [ | |
{ | |
"compression_level": 9, | |
"output": "../centos_71.box", | |
"type": "vagrant" | |
} | |
] | |
} | |
// html/kickstart.cfg | |
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 Europe/Amsterdam | |
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" | |
text | |
skipx | |
zerombr | |
clearpart --all --initlabel | |
autopart | |
auth --useshadow --enablemd5 | |
firstboot --disabled | |
reboot | |
%packages --ignoremissing | |
@core | |
bzip2 | |
kernel-devel | |
kernel-headers | |
-ipw2100-firmware | |
-ipw2200-firmware | |
-ivtv-firmware | |
%end | |
%post | |
/usr/bin/yum -y install sudo | |
/usr/sbin/groupadd -g 501 vagrant | |
/usr/sbin/useradd vagrant -u 501 -g vagrant -G wheel | |
echo "vagrant"|passwd --stdin vagrant | |
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant | |
echo "Defaults:vagrant !requiretty" >> /etc/sudoers.d/vagrant | |
chmod 0440 /etc/sudoers.d/vagrant | |
%end | |
// scripts/base.sh | |
#!/bin/sh | |
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers | |
yum -y install gcc make gcc-c++ kernel-devel-`uname -r` perl | |
// scripts/vagrant.sh | |
#!/bin/sh | |
date > /etc/vagrant_box_build_time | |
mkdir -pm 700 /home/vagrant/.ssh | |
curl -L https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -o /home/vagrant/.ssh/authorized_keys | |
chmod 0600 /home/vagrant/.ssh/authorized_keys | |
chown -R vagrant:vagrant /home/vagrant/.ssh | |
// scripts/virtualbox.sh | |
#!/bin/sh | |
VBOX_VERSION=$(cat /home/vagrant/.vbox_version) | |
# required for VirtualBox 4.3.26 | |
yum install -y bzip2 | |
cd /tmp | |
mount -o loop /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt | |
sh /mnt/VBoxLinuxAdditions.run | |
umount /mnt | |
rm -rf /home/vagrant/VBoxGuestAdditions_*.iso | |
// scripts/cleanup.sh | |
#!/bin/sh | |
yum -y erase gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts | |
yum -y clean all | |
rm -rf VBoxGuestAdditions_*.iso | |
rm -rf /tmp/rubygems-* | |
// scripts/puppet.sh | |
#!/bin/sh | |
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm | |
yum -y install puppet | |
// Vagrantfile | |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.box = "centos_71.box" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment