Last active
April 18, 2020 15:20
-
-
Save SMAK1993/fc6ca44b2e967471c5f99635481d7a80 to your computer and use it in GitHub Desktop.
Script to set the boot device on all machines in MAAS
This file contains 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
#!/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