#14906·algo

Reduce complexity in server.yml and templates

Author: dguidoCreated Nov 28, 2025Updated Nov 28, 2025

Summary

Several complexity reduction opportunities identified in server.yml and templates.

Changes

4.2 Deduplicate Async Job Tracking in server.yml

Current: Lines 54-115 (parallel) duplicate lines 117-135 (sequential) - 60+ lines of duplication.

Fix: Single task block with async controlled by performance_parallel_services variable.

4.3 Simplify IPv6 Conditional Pattern

Current (repeated 20+ times across templates):

jinja2
{{ value_ipv4 }}{{ ', ' + value_ipv6 if ipv6_support else '' }}

Create Jinja2 Macro in roles/common/templates/macros.j2:

jinja2
{% macro dual_stack(ipv4, ipv6) -%}
{{ ipv4 }}{% if ipv6_support %}, {{ ipv6 }}{% endif %}
{%- endmacro %}

4.4 Consolidate Iptables Tasks

File: roles/common/tasks/iptables.yml

Current: Two nearly identical task blocks (v4 and v6). Refactor to single loop with condition.

Impact

  • Removes ~60 lines of duplicated code
  • Simplifies template maintenance
  • Reduces risk of v4/v6 configuration drift