Vagrant

Drew Sears edited this page Jul 7, 2017 · 4 revisions

Subtopics

Tips

Get the status of all running or powered off boxes

vagrant global-status

Halt all running boxes

vagrant global-status | awk '/running/{print $1}' | xargs -r -d '\n' -n 1 -- vagrant halt

Via http://askubuntu.com/a/564674.

CentOS 7 bootstrap script:

Bootstrap a CentOS 7 image for Vagrant:

  • Disable SELinux
  • Install Ansible
  • Install VirtualBox 4 guest additions

Step 1:

#!/bin/bash

echo "Turn off SELinux enforcement"
sed -ie 's/enforcing/permissive/g' /etc/selinux/config

echo "Installing EPEL"
yum -y install epel-release

echo "Full yum update"
yum -y update

echo "Installing extra yum packages for Ansible"
yum install -y \
  dkms \
  gcc \
  kernel-devel \
  openssl-devel \
  python-pip \
  python-devel

echo "Installing development tools"
yum groupinstall -y "Development Tools"

echo "Upgrading pip"
pip install --upgrade pip

echo "Installing ansible"
pip install ansible

reboot

Step 2:

#!/bin/bash

echo "Downloading VirtualBox guest additions"
cd /tmp
curl -O http://download.virtualbox.org/virtualbox/4.3.36/VBoxGuestAdditions_4.3.36.iso

echo "Mounting ISO"
mkdir /mnt/iso
mount -t iso9660 -o loop /tmp/VBoxGuestAdditions_4.3.36.iso /mnt/iso/

echo "Get kernel directory"
KERN_DIR=/usr/src/kernels/`uname -r`
export KERN_DIR

echo "Install VirtualBox guest additions"
cd /mnt/iso
./VBoxLinuxAdditions.run