Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Add centos 7 box
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-muehle committed Jul 16, 2015
1 parent 63ebc6c commit 737646e
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 0 deletions.
16 changes: 16 additions & 0 deletions definitions/centos-7.0-x86_64/base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Base install

sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers

cat > /etc/yum.repos.d/epel.repo << EOM
[epel]
name=epel
baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch
enabled=1
gpgcheck=0
EOM

yum -y install gcc make gcc-c++ kernel-devel-`uname -r` zlib-devel openssl-devel readline-devel sqlite-devel perl wget dkms nfs-utils vim bzip2

# Make ssh faster by not waiting on DNS
echo "UseDNS no" >> /etc/ssh/sshd_config
4 changes: 4 additions & 0 deletions definitions/centos-7.0-x86_64/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
yum -y erase freetype
yum -y clean all
rm -rf /etc/yum.repos.d/{puppetlabs,epel}.repo
rm -rf VBoxGuestAdditions_*.iso
36 changes: 36 additions & 0 deletions definitions/centos-7.0-x86_64/definition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Veewee::Session.declare({
:cpu_count => '1',
:memory_size=> '1024',
:disk_size => '10140',
:disk_format => 'VDI',
:hostiocache => 'off',
:os_type_id => 'RedHat6_64',
:iso_file => "CentOS-7-x86_64-NetInstall-1503.iso",
:iso_src => "http://mirror.netcologne.de/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1503.iso",
:iso_md5 => "111379a06402e1e445c6aeee9401d031",
:iso_download_timeout => 1000,
:boot_wait => "10",
:boot_cmd_sequence => [
'<Tab> text ks=http://%IP%:%PORT%/ks.cfg<Enter>'
],
:kickstart_port => "7122",
:kickstart_timeout => 300,
:kickstart_file => "ks.cfg",
:ssh_login_timeout => "10000",
: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 => [
"base.sh",
"puppet.sh",
"vagrant.sh",
"virtualbox.sh",
"cleanup.sh",
"zerodisk.sh"
],
:postinstall_timeout => 10000
})
38 changes: 38 additions & 0 deletions definitions/centos-7.0-x86_64/ks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
install
url --url=http://mirror.centos.org/centos/7/os/x86_64/
lang de_DE.UTF-8
keyboard de
network --bootproto=dhcp
rootpw --iscrypted $1$damlkd,f$UC/u5pUts5QiU3ow.CSso/
firewall --enabled --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Europe/Berlin
bootloader --location=mbr

text
skipx
zerombr

clearpart --all --initlabel
autopart

auth --useshadow --enablemd5
firstboot --disabled
reboot

%packages --nobase
@core
openssh-clients
openssh-server
%end

%post
/usr/bin/yum -y install sudo
/usr/sbin/groupadd vagrant
/usr/sbin/useradd vagrant -g vagrant -G vagrant
echo "vagrant"|passwd --stdin vagrant
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
chmod 0440 /etc/sudoers.d/vagrant
%end

18 changes: 18 additions & 0 deletions definitions/centos-7.0-x86_64/puppet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Install Puppet

cat > /etc/yum.repos.d/puppetlabs.repo << EOM
[puppetlabs-dependencies]
name=puppetlabdsdependencies
baseurl=http://yum.puppetlabs.com/el/7/dependencies/\$basearch
enabled=1
gpgcheck=0
[puppetlabs]
name=puppetlabs
baseurl=http://yum.puppetlabs.com/el/7/products/\$basearch
enabled=1
gpgcheck=0
EOM

yum -y install puppet facter ruby-shadow

18 changes: 18 additions & 0 deletions definitions/centos-7.0-x86_64/vagrant.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Vagrant specific
date > /etc/vagrant_box_build_time

# Add vagrant user
/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

# Installing vagrant keys
mkdir -pm 700 /home/vagrant/.ssh
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh

# Customize the message of the day
echo 'Welcome to your Vagrant-built virtual machine.' > /etc/motd
8 changes: 8 additions & 0 deletions definitions/centos-7.0-x86_64/virtualbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Installing the virtualbox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
cd /tmp
mount -o loop /home/vagrant/VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt
rm -rf /home/vagrant/VBoxGuestAdditions_*.iso

3 changes: 3 additions & 0 deletions definitions/centos-7.0-x86_64/zerodisk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Zero out the free space to save space in the final image:
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY

0 comments on commit 737646e

Please sign in to comment.