mirror of
https://github.com/trailofbits/algo.git
synced 2026-08-17 21:25:50 +02:00
* feat: add destroy subcommand to tear down deployed servers 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> * feat: add list-servers script and tests 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> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
1.4 KiB
YAML
56 lines
1.4 KiB
YAML
---
|
|
- name: Get zones
|
|
gcp_compute_location_info:
|
|
auth_kind: serviceaccount
|
|
service_account_file: "{{ credentials_file_path }}"
|
|
project: "{{ project_id }}"
|
|
scope: zones
|
|
filters:
|
|
- name={{ algo_region }}-*
|
|
- status=UP
|
|
register: gcp_compute_zone_info
|
|
|
|
- name: Set zone
|
|
set_fact:
|
|
algo_zone: >-
|
|
{{ (gcp_compute_zone_info.resources |
|
|
random(seed=algo_server_name + algo_region + project_id)
|
|
).name }}
|
|
|
|
- name: Destroy GCE instance
|
|
gcp_compute_instance:
|
|
auth_kind: serviceaccount
|
|
service_account_file: "{{ credentials_file_path }}"
|
|
project: "{{ project_id }}"
|
|
name: "{{ algo_server_name }}"
|
|
zone: "{{ algo_zone }}"
|
|
state: absent
|
|
|
|
- name: Remove static IP
|
|
gcp_compute_address:
|
|
auth_kind: serviceaccount
|
|
service_account_file: "{{ credentials_file_path }}"
|
|
project: "{{ project_id }}"
|
|
name: "{{ algo_server_name }}"
|
|
region: "{{ algo_region }}"
|
|
state: absent
|
|
failed_when: false
|
|
|
|
- name: Remove firewall rule
|
|
gcp_compute_firewall:
|
|
auth_kind: serviceaccount
|
|
service_account_file: "{{ credentials_file_path }}"
|
|
project: "{{ project_id }}"
|
|
name: algovpn
|
|
state: absent
|
|
failed_when: false
|
|
|
|
- name: Remove network
|
|
gcp_compute_network:
|
|
auth_kind: serviceaccount
|
|
service_account_file: "{{ credentials_file_path }}"
|
|
project: "{{ project_id }}"
|
|
name: algovpn
|
|
state: absent
|
|
failed_when: false
|