feat: add destroy subcommand to tear down deployed servers#14965
Merged
feat: add destroy subcommand to tear down deployed servers#14965
Conversation
Add `./algo destroy <server-ip>` to programmatically remove cloud resources and clean up local configs. Reads provider and server name from configs/<ip>/.config.yml, gathers credentials via existing prompts.yml, confirms with user, then dispatches to provider-specific destroy tasks. Supports all 11 cloud providers: - DigitalOcean, EC2, Lightsail (CloudFormation), Azure (resource group), GCE (instance + subsidiary resources), Hetzner, Vultr, Scaleway, OpenStack, CloudStack, Linode - Local provider: config cleanup only Also stores algo_region in .config.yml during deployment so destroy can auto-detect region. Fixes Scaleway module to allow state=absent without image/commercial_type/organization params. Adds Vultr to region-required providers and stores algo_region in Vultr prompts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add scripts/list_servers.py to scan configs/ for deployed server metadata and output JSON. Referenced by `./algo list-servers`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
./algo destroy <server-ip>subcommand to programmatically remove cloud resources and clean up local configsdestroy.ymlplaybook that loads server config, gathers provider credentials, confirms with user, and dispatches to provider-specific destroy tasksalgo_regionin.config.ymlduring deployment so destroy can auto-detect regionrequired_ifinstead of unconditionalrequired=Trueforimage,commercial_type,organization— enablesstate: absentwithout placeholder valuesalgo_regionin Vultr promptsDetails
The destroy flow:
server_ipis providedconfigs/<ip>/.config.ymlto get provider, server name, and regionprompts.ymlfiles (no duplicated auth logic)-e confirm_destroy=true)roles/cloud-<provider>/tasks/destroy.ymlProvider-specific behavior:
force_delete_nonemptyRegion handling: EC2, Lightsail, GCE, Scaleway, and Vultr require region for deletion. The region is auto-detected from
.config.ymlfor new deployments. For servers deployed before this change, pass-e region=YOUR_REGION.Test plan
ansible-playbook destroy.yml --syntax-checkpassesansible-lint destroy.ymlpasses at production profilepytest tests/unit/test_destroy.py -q— 22 tests passpytest tests/unit/ -q— full suite (119 tests) passes./algo destroyshows usage and exits 1./algo helplists destroy command🤖 Generated with Claude Code