Skip to content

Instantly share code, notes, and snippets.

View andrewschoen's full-sized avatar

Andrew Schoen andrewschoen

View GitHub Profile
@alfredodeza
alfredodeza / prepare.sh
Created March 21, 2017 15:22
Customize a (rhel/centos) qcow2 image so that it can be used with Vagrant
#!/bin/bash -x
# Setup hostname vagrant-something.
FQDN="vagrant-rhel7"
if grep '^HOSTNAME=' /etc/sysconfig/network > /dev/null; then
sed -i 's/HOSTNAME=\(.*\)/HOSTNAME='${FQDN}'/' /etc/sysconfig/network
else
echo "HOSTNAME=${FQDN}" >> /etc/sysconfig/network
fi
@alfredodeza
alfredodeza / process.sh
Created March 21, 2017 15:22
Process a qcow2 image so that it can be customized as a vagrant box (meant for rhel images mostly)
#!/bin/bash
# The input is a qcow2 image, that gets copied via virt-customize so that it
# can be modified to work as a vagrant box. It requires the `create_box.sh` script
# from the vagrant-libvirt project::
#
# https://github.com/vagrant-libvirt/vagrant-libvirt/blob/master/tools/create_box.sh
#
# Usage:
#
# bash process.sh rhel-guest-image-7.4-10.x86_64.qcow2 rhel7.qcow2