Skip to content

Instantly share code, notes, and snippets.

@SMAK1993
Last active April 18, 2020 15:20
Show Gist options
  • Save SMAK1993/fc6ca44b2e967471c5f99635481d7a80 to your computer and use it in GitHub Desktop.
Save SMAK1993/fc6ca44b2e967471c5f99635481d7a80 to your computer and use it in GitHub Desktop.
Script to set the boot device on all machines in MAAS
#!/bin/bash
tagName=foundation-nodes
diskName="os$"
machines=$(maas root tag machines $tagName | jq -r '.[] | .system_id')
for machine in $machines
do
diskId=$(maas root block-devices read $machine | jq -r '.[] | .name, .id' | grep $diskName -A 1 | tail -n 1)
echo "maas root block-device set-boot-disk $machine $diskId"
maas root block-device set-boot-disk $machine $diskId
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment