Skip to content

Instantly share code, notes, and snippets.

@rbo
Created January 21, 2020 10:43
Show Gist options
  • Save rbo/18cd9616348f07aff7acbb5c491f9651 to your computer and use it in GitHub Desktop.
Save rbo/18cd9616348f07aff7acbb5c491f9651 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ $# -eq 0 ] ; then
echo "Usage: $0 HOSTNAME bootstrap_ignition_config_url";
exit 1;
fi
HOSTNAME=${1:-bootstrap.ocp4-upi.bohne.io}
IGN_URL=${2}
json=$(cat <<EOF
{
"ignition": {
"config": {
"append": [
{
"source": "$IGN_URL",
"verification": {}
}
]
},
"timeouts": {},
"version": "2.1.0"
},
"networkd": {},
"passwd": {},
"systemd": {},
"storage": {
"files": [
{
"contents": {
"source":"data:text/plain;charset=utf-8;base64,$(echo $HOSTNAME | base64 -w0 )"
},
"filesystem": "root",
"path": "/etc/hostname",
"mode": 420,
"user": {
"name": "root"
}
}
]
}
}
EOF
)
echo $json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment