Skip to content

Instantly share code, notes, and snippets.

@jackprice
Last active April 11, 2017 05:46
Show Gist options
  • Save jackprice/89df795db65d6748834e518b7504dc24 to your computer and use it in GitHub Desktop.
Save jackprice/89df795db65d6748834e518b7504dc24 to your computer and use it in GitHub Desktop.
Ansible+Kickstarter Makefile
#!/usr/bin/env bash
set -e
VOLUME_LABEL="OEMDRV"
if [ $# -ne 2 ]; then
echo "Invalid invocation"
echo "Usage:"
echo
echo " $0 SOURCE OUTPUT"
echo
echo " SOURCE should be a built Kickstart configuration file"
echo " OUTPUT should be the location to store the built ISO"
echo
exit 1
fi
SOURCE="$1"
DEST="$2"
if [ ! -f "$SOURCE" ]; then
echo "Source file does not exist"
exit 1
fi
TEMP=$(mktemp -d)
cp "$SOURCE" "${TEMP}/ks.cfg"
mkisofs -V "$VOLUME_LABEL" -o "$DEST" "$TEMP"
rm -r "$TEMP"
build/%.iso: build/%.cfg
./build-configuration-iso.sh build/$*.cfg build/$*.iso
build/%.cfg: kickstart.cfg.j2
ansible-playbook --limit $* template-kickstart.yml
.PHONY: clean
clean:
rm -rf build/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment