mirror of
https://github.com/trailofbits/algo.git
synced 2026-09-23 18:15:00 +02:00
* Simplify codebase: remove dead venv files, consolidate loops, modernize patterns - Delete 8 empty venv.yml files that were remnants of pyproject.toml migration - Remove corresponding import_tasks references from cloud provider main.yml files - Consolidate server.yml async polling from 4 copy-paste blocks to 1 loop - Wrap sequential VPN service imports in a block with single when condition - Replace deprecated with_indexed_items with modern loop/loop_control syntax These changes reduce maintenance burden by: - Eliminating 8 files that served no purpose - Reducing server.yml by ~20 lines while improving readability - Removing Ansible deprecation warnings for with_indexed_items - Making the parallel/sequential execution paths easier to maintain 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix template variable and undefined job variable bugs - Fix client.conf.j2 to use `item` instead of `item.1` to match modern loop syntax (loop with index_var instead of with_indexed_items) - Fix server.yml _vpn_jobs to use `| default({})` for job variables that may be undefined when running with tags (e.g., IPsec-only) - Update test_template_rendering.py to pass item as string instead of tuple, matching the new loop behavior Fixes CI failures from PR #14891 that were correctly identified by the Claude Code bot review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
56 lines
2.1 KiB
YAML
56 lines
2.1 KiB
YAML
---
|
|
- name: Include prompts
|
|
import_tasks: prompts.yml
|
|
|
|
- block:
|
|
- set_fact:
|
|
algo_region: >-
|
|
{%- if region is defined -%}{{ region }}{%- elif _algo_region.user_input is defined and _algo_region.user_input | length > 0 -%}{{ cs_zones[_algo_region.user_input | int - 1]['name'] }}{%- else -%}{{ cs_zones[default_zone | int - 1]['name'] }}{%- endif -%}
|
|
|
|
- name: Security group created
|
|
cs_securitygroup:
|
|
name: "{{ algo_server_name }}-security_group"
|
|
description: AlgoVPN security group
|
|
register: cs_security_group
|
|
|
|
- name: Security rules created
|
|
cs_securitygroup_rule:
|
|
security_group: "{{ cs_security_group.name }}"
|
|
protocol: "{{ item.proto }}"
|
|
start_port: "{{ item.start_port }}"
|
|
end_port: "{{ item.end_port }}"
|
|
cidr: "{{ item.range }}"
|
|
loop:
|
|
- { proto: tcp, start_port: "{{ ssh_port }}", end_port: "{{ ssh_port }}", range: 0.0.0.0/0 }
|
|
- { proto: udp, start_port: 4500, end_port: 4500, range: 0.0.0.0/0 }
|
|
- { proto: udp, start_port: 500, end_port: 500, range: 0.0.0.0/0 }
|
|
- { proto: udp, start_port: "{{ wireguard_port }}", end_port: "{{ wireguard_port }}", range: 0.0.0.0/0 }
|
|
|
|
- name: Set facts
|
|
set_fact:
|
|
image_id: "{{ cloud_providers.cloudstack.image }}"
|
|
size: "{{ cloud_providers.cloudstack.size }}"
|
|
disk: "{{ cloud_providers.cloudstack.disk }}"
|
|
|
|
- name: Server created
|
|
cs_instance:
|
|
name: "{{ algo_server_name }}"
|
|
root_disk_size: "{{ disk }}"
|
|
template: "{{ image_id }}"
|
|
security_groups: "{{ cs_security_group.name }}"
|
|
zone: "{{ algo_region }}"
|
|
service_offering: "{{ size }}"
|
|
user_data: "{{ lookup('template', 'files/cloud-init/base.yml') }}"
|
|
register: cs_server
|
|
|
|
- set_fact:
|
|
cloud_instance_ip: "{{ cs_server.default_ip }}"
|
|
ansible_ssh_user: algo
|
|
ansible_ssh_port: "{{ ssh_port }}"
|
|
cloudinit: true
|
|
environment:
|
|
CLOUDSTACK_KEY: "{{ algo_cs_key }}"
|
|
CLOUDSTACK_SECRET: "{{ algo_cs_token }}"
|
|
CLOUDSTACK_ENDPOINT: "{{ algo_cs_url }}"
|
|
no_log: true
|