Last active
December 19, 2015 04:59
-
-
Save lorin/5901189 to your computer and use it in GitHub Desktop.
Building CentOS 6.4 images that resize on boot, with oz, libguestfs, and Robert Plestenjak's centos-image-resize script
This file contains hidden or 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
install | |
text | |
key --skip | |
keyboard us | |
lang en_US.UTF-8 | |
skipx | |
network --device eth0 --bootproto dhcp | |
rootpw %ROOTPW% | |
firewall --disabled | |
authconfig --enableshadow --enablemd5 | |
selinux --enforcing | |
timezone --utc America/New_York | |
bootloader --location=mbr --append="console=tty0 console=ttyS0,115200" | |
zerombr yes | |
clearpart --all | |
part / --fstype ext4 --size=1024 --grow | |
reboot | |
%packages | |
@base | |
%post |
This file contains hidden or 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
<template> | |
<name>centos-6.4</name> | |
<os> | |
<name>CentOS-6</name> | |
<version>4</version> | |
<arch>x86_64</arch> | |
<install type='iso'> | |
<iso>file:///data/isos/CentOS-6.4-x86_64-bin-DVD1.iso</iso> | |
</install> | |
</os> | |
<description>CentOS 6.4 x86_64</description> | |
<repositories> | |
<repository name='epel-6'> | |
<url>http://download.fedoraproject.org/pub/epel/6/$basearch</url> | |
<signed>no</signed> | |
</repository> | |
</repositories> | |
<packages> | |
<package name="epel-release" /> | |
<package name="cloud-utils" /> | |
<package name="cloud-init" /> | |
</packages> | |
<commands> | |
<command name="resize"> | |
cd /tmp | |
wget https://github.com/flegmatik/centos-image-resize/archive/master.zip -O centos-image-resize-master.zip | |
unzip centos-image-resize-master.zip | |
cd centos-image-resize-master | |
chmod +x init-part | |
/bin/bash ./centos-image-mod.sh | |
</command> | |
<command name="openstack-user"> | |
useradd openstack | |
sed -i 's/^user:.*/user: openstack/' /etc/cloud/cloud.cfg | |
echo "openstack ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/openstack | |
</command> | |
<!-- virt-sysprep bug requires that we manually edit ifcfg-eth0. | |
See https://bugzilla.redhat.com/show_bug.cgi?id=811117 | |
This is fixed in later versions, but broken on precise --> | |
<command name="remove-hwaddr"> | |
sed -i '/^HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth0 | |
</command> | |
</commands> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment