Last active
August 16, 2023 15:54
-
-
Save displague/063dbe83d141a941ec936bc53b6a9a75 to your computer and use it in GitHub Desktop.
delete tfacc packet devices and projects
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
#!/usr/bin/env bash | |
CMD=metal | |
# METAL_ORGANIZATION_ID=(the one you want to clean), otherwise defaults to metal cli settings) | |
$CMD project get | \ | |
awk '/\s*(tfacc|GHACTION|ansible)/ {print $2}' | \ | |
while read proj; do | |
$CMD devices get -p $proj | \ | |
awk '/tfacc|ansible|GHACTION/ {print $2}' | \ | |
xargs -n1 $CMD device delete -f --id ; | |
$CMD project delete -f --id $proj ; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment