Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lae

lae/compute.ks Secret

Created May 10, 2018 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lae/95161ed9eafbcd3637842bd188f7c65a to your computer and use it in GitHub Desktop.
Save lae/95161ed9eafbcd3637842bd188f7c65a to your computer and use it in GitHub Desktop.
~]$ curl http://<provision server>:8091/machines/44b07ca2-7107-42e4-9cd2-e51ac0ad7458/compute.ks
# DigitalRebar Provision Centos-7 (and related distros) kickstart
install
url --url http://<package server>/centos/7/os/x86_64
repo --name="centos-7-install" --baseurl=http://<package server>/centos/7/os/x86_64 --cost=100
# key --skip
# Disable geolocation for language and timezone
# Currently broken by https://bugzilla.redhat.com/show_bug.cgi?id=1111717
# geoloc 0
timezone --utc UTC
lang en_US.UTF-8
keyboard us
# rebar
rootpw --iscrypted <hash>
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
bootloader --location=mbr --append="rhgb quiet"
zerombr
clearpart --all
part /boot --fstype ext4 --size=512
part /boot/efi --fstype vfat --size=512
part swap --recommended
part pv.6 --size=1 --grow
volgroup <host> --pesize=32768 pv.6
logvol / --fstype ext4 --name=lv_root --vgname=<host> --size=1 --grow --maxsize=10240
text
reboot
%packages
@core
trousers
fipscheck
device-mapper-multipath
openssh
curl.x86_64
efibootmgr
tar
%end
%post
exec > /root/post-install.log 2>&1
set -x
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
#!/usr/bin/env bash
#!/usr/local/bin/env bash
# Helper to setup DRP tasks for other templates
#
###
# This is a BASH script snippet intended to be run inside other BASH templates.
#
# Simple helper to prep a system with DRPCLI and JQ. If not already installed,
# download and install the `drpcli` and `jq` binaries in /usr/local/bin and then
# source our `helper` tools
#
# To use this in other templates, simply specify:
#
# \{\{template "setup.tmpl" .\}\}
#
# without the backslashes.
###
set -e
###
# if we want debugging of our scripts, set the Param to true
# also set shell variable for script reuse if desired for further
# debugging
###
# We pretty much always need these parameters set, but
# don't overwrite them if they already exist.
[[ $RS_TOKEN ]] || export RS_TOKEN="wYXstYC0Y2r0389W-GbkPWHqvHdbqQ4SwRTcv1KvEUp0Fy7TtONQWivqTJ-iDh0UN7s7osgSvLmbZfLxLMrzgZ3uXrCVHv00xfcCOnDAXQvVylQkKjplmgkthdCV5IED0OcJSXsQjSTVrA5q_05mOrnMIp-6RaYFAxM2A-BK95SCwP4d9GPUFavTIPlfyRIQ8iXqBiCkwVmGEOGPLAj5Wu3-I8HGIDVaTGE6UKzLUKbY-beo6aY8i0s-h9OGRYE2DkASDEMpaAQotAIiinIQCkPES4f57Rd8b8jvcLGnd7qr7Ffg4oP5UtUj86T8NBx57IvdpiMihB2c5bJO58u7Z1wX6DPPkM_rirPO7_I3VAhhgTrOxHJquzHhv1NEOjBpD8JPAM2Eqmk2nfOb8WXuNJUHiBK9R7R4Vtf1WqfCuBeOSJaESTs0cnVs_AFxQYsjMsk3MEKij2bc_4fWod8SlRtWMJIkeQElGcjBInXyPunBAaVCLln6lKdxYR_jkwx-eyLpQTpnFLNFUzJBe3DtL2bzNrbL3ORg3YdDxTje0ys4lzWyxt_mckLGs5a1epA042igRVq6Bi_bO6LzbeldiCIzbOKHTEFIjd5NtP56-szPC85ozs0Azf8FyFLb00-pqpo7t18hdXAgysdTmSv5OMtFgqRlLR5SqpulW8HzQZ9OOlVcsWAZB-fBwvZqoEtCfTtgkMxPYlHMmiFNCFgRIVNBsz7MyUAuyKTyu__fXKQ71AYdPZB1HbWJVDpTmacky_wpSdtlhoAkOKQE_LAkvZcfKm671Auzw1BZPbcwfLtEuvekotYaR2bqYKbD0DncvcQ7phEweA-sCcgRLeuOVYLmjeub2U5IAUlQYBMszjSW1FNfTz-7aQMmO1Yy7ZdD-Ng5SzW7x3XKauBIkf4f7r734UQyQYq8mRb3Y5WNUdysATVE__kh1AN5VMl1cUjn4GBWQl_6XDHb2D8BbmOCvFPS5P5icNWyYG-R2aixOosXrDgO2G4hgvFb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w55afOo73eXGLRC5xVrKFmUATxln8Mwu4y4eJ_6fGphfmUG8pECvAsBJRPTg774cp41kNhgTxeNRTbY5wcJrEaH03HPIQwAYxVF5-r1lcYrwusV8lDUHXr-nb6ATC5-2LbcDHXc-CuHuVxa7ppJnvdRuJwVmKeJZJ1p2e51knIoVfhDw-bxETnFHWNplFGgGnVPw2gBsjsfMjhQea5610u8nTdp-gbYVUx4lWBgclcRZUWh2F8AqIIGzSb-WauzjvRSnJV4TUQRTrU0E6-yUZLctw2bCnlF-mljkR62icZl_j29wtkFSsHdoaHF4"
[[ $RS_ENDPOINT ]] || export RS_ENDPOINT="https://<provision server>:8092"
[[ $RS_UUID ]] || export RS_UUID="44b07ca2-7107-42e4-9cd2-e51ac0ad7458"
mkdir -p /usr/local/bin
grep -q '/usr/local/bin' <<< "$PATH" || export PATH="$PATH:/usr/local/bin"
# TODO: we need to make drpcli/jq grab smarter to be a little
# more tolerant of OS arch/type - and grab the right one
for tool in drpcli jq; do
which "$tool" &>/dev/null && continue
echo "Installing $tool in /usr/local/bin"
case $tool in
drpcli) curl -sfLo "/usr/local/bin/$tool" "http://<provision server>:8091/files/drpcli.amd64.linux";;
jq) curl -sfLo "/usr/local/bin/$tool" "http://<provision server>:8091/files/jq";;
esac
chmod 755 "/usr/local/bin/$tool"
done
unset tool
if [[ -r ./helper ]]; then
. ./helper
__sane_exit
fi
# One day Reset the workflow chain here as well
# Reset the current task list and mark the machine runnable.
drpcli machines update "44b07ca2-7107-42e4-9cd2-e51ac0ad7458" '{ "Runnable": true, "CurrentTask": -1 }'
#!/usr/bin/env bash
#!/usr/local/bin/env bash
# Helper to setup DRP tasks for other templates
#
###
# This is a BASH script snippet intended to be run inside other BASH templates.
#
# Simple helper to prep a system with DRPCLI and JQ. If not already installed,
# download and install the `drpcli` and `jq` binaries in /usr/local/bin and then
# source our `helper` tools
#
# To use this in other templates, simply specify:
#
# \{\{template "setup.tmpl" .\}\}
#
# without the backslashes.
###
set -e
###
# if we want debugging of our scripts, set the Param to true
# also set shell variable for script reuse if desired for further
# debugging
###
# We pretty much always need these parameters set, but
# don't overwrite them if they already exist.
[[ $RS_TOKEN ]] || export RS_TOKEN="kh5dDPJgFNzSsUUyJpWvkZNsSXxh5MFTKUnyZXm6ugyNVKoYRxKlJBavbH0m_rI8dNcnoejwcai1ff7xCVwlq9DAsZM9PeMeQH6wOALYRHjJFA-VCy7lFbPloUvHQq9FZp7WS-mQqkGhOCQnUCA8tRGqWmme7pOLo04xa1IUn_AjJ9D0R-5I9yApo3lPoJoRnkvahHmPXBA-MsrGcH2ar9TiNreuHmkrAb4y7XsUN76ifJN4k0CQVvg4rvxbLLwHQ5D0Sw1NN9Hgj_zLA2TLvWWhYvNw64VjjNKc8VE_8_TNgyqJxu69X4wNg55kFzm-L_9YcRXX1leDOX1_eMSNd8Gkl_zQ7Z6rQvM0DMvRhMr1TyY2s-p-h6hLbQuWIklK4K-iwZC9LSnoebOtQNMZla30Ae9LRYuvrjW-mmz2TCDltnSDn1O6qzB7tfyiu4YQavcgH82K8UV88tsdTwjiW9sR8peOWA05ReFrO2pMPh01GbqMrjSAM3xxlJWVzLqP93hS4R0VfkjfcNSavKnlNAYVTXe1BNiFlsxwaGDco7obYlOl7NkdTPXxgW6Azp5fO2MHwR7YoTTx4tM9yNzGVEQ-DZ97F9EVTTbW3O2u0WGg9bja_Wuqj_6roRQQ0-ugdk2PocxJHqmpMdt7Po1z63S3kxFqzvY0Koxqr0pkcAfCh1N3rabsWrpgQQxknsGDKT03wRetUk8wBvJAm7TmlGDqf4i5H09CM9gW1a0koyRYdrp0YM7O72VmwvHvEkJag9cQyB_-iPZEgLpD_RbGQGj5zpwYrwtytf6hYX6rVuIgjA3cu53nFzk5NGINHk8JZPovY4jyeHq7oUe348UsWWACNif4hDXt2ClWOanP25t9Gm_Bl6KTlyOv_6Ti5pnnc89Y8UnvIaOu_6R_1h3YinX32C_d159JcjZqsNIWsoiCUe1PWLmZayu22PBaaUX6V_RcZ4FB5gYM3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wgQEZLkz1RVPW-C_-W9dVtXkzx7o6N7qjEAphOFu5pHdbzzYAFjhLH2asNlSJ0XJ4eWcbmEyXC5dUfZQBPWMccyi00sis7Lhd8RK4PN6fAH-dLqin9sGcjJXzWMkCl-bo4m3JZjtRtsOXgmnCND6owZgLUKF3ZRFdzK9MnDzOftyUK6S-jEAVxZJ24vibfvfmJIG_q-VyZMUouXm4kftrzdZZk9AixsOw8VJnKfnnFganjMhZmyPUIvtL8DIMkCEJ9MtxvtxmHVKT1CSDpD5IC9bBd7-PE5r11E4YSMaakgO-B6Di-83vw6tatyvyUWdVwGYZRz7aplPiTHWS"
[[ $RS_ENDPOINT ]] || export RS_ENDPOINT="https://<provision server>:8092"
[[ $RS_UUID ]] || export RS_UUID="44b07ca2-7107-42e4-9cd2-e51ac0ad7458"
mkdir -p /usr/local/bin
grep -q '/usr/local/bin' <<< "$PATH" || export PATH="$PATH:/usr/local/bin"
# TODO: we need to make drpcli/jq grab smarter to be a little
# more tolerant of OS arch/type - and grab the right one
for tool in drpcli jq; do
which "$tool" &>/dev/null && continue
echo "Installing $tool in /usr/local/bin"
case $tool in
drpcli) curl -sfLo "/usr/local/bin/$tool" "http://<provision server>:8091/files/drpcli.amd64.linux";;
jq) curl -sfLo "/usr/local/bin/$tool" "http://<provision server>:8091/files/jq";;
esac
chmod 755 "/usr/local/bin/$tool"
done
unset tool
if [[ -r ./helper ]]; then
. ./helper
__sane_exit
fi
# Create a temp workspace
temp_dir="$(mktemp -d)"
cd "$temp_dir"
drpcli machines processjobs "44b07ca2-7107-42e4-9cd2-e51ac0ad7458"
rm -rf "$temp_dir"
sync
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment