Skip to content

Instantly share code, notes, and snippets.

@displague
Last active August 16, 2023 15:54
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 displague/063dbe83d141a941ec936bc53b6a9a75 to your computer and use it in GitHub Desktop.
Save displague/063dbe83d141a941ec936bc53b6a9a75 to your computer and use it in GitHub Desktop.
delete tfacc packet devices and projects
#!/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