Skip to content

Commit e244311

Browse files
committed
docs: update template system architecture and contributing guides
1 parent a819b24 commit e244311

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

docs/contributing/pr-review-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Verify contributors followed these project conventions:
4444
### Templates (if applicable)
4545

4646
- [ ] **Tera templates use correct syntax**: `{{ variable }}` not `{ { variable } }` (see [templates.md](./templates.md))
47-
- [ ] **Static Ansible playbooks** (without `.tera` extension) are registered in `src/infrastructure/external_tools/ansible/template/renderer/mod.rs`
47+
- [ ] **Static Ansible playbooks** (without `.tera` extension) are registered in `src/infrastructure/external_tools/ansible/template/renderer/project_generator.rs`
4848

4949
## 🚩 Quick Red Flags
5050

docs/contributing/templates.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Write standard Ansible YAML with no Tera variables:
149149
150150
**This is the step that's easy to miss!**
151151
152-
Add your playbook filename to the array in `src/infrastructure/external_tools/ansible/template/renderer/mod.rs`:
152+
Add your playbook filename to the array in `src/infrastructure/external_tools/ansible/template/renderer/project_generator.rs`:
153153

154154
```rust
155155
// Find the copy_static_templates method
@@ -268,7 +268,7 @@ When adding a static Ansible playbook:
268268

269269
- [ ] Create `.yml` file in `templates/ansible/`
270270
- [ ] Write standard Ansible YAML (no Tera variables)
271-
- [ ] Add filename to `copy_static_templates` array in `src/infrastructure/external_tools/ansible/template/renderer/mod.rs`
271+
- [ ] Add filename to `copy_static_templates` array in `src/infrastructure/external_tools/ansible/template/renderer/project_generator.rs`
272272
- [ ] Update file count in debug log
273273
- [ ] Run E2E tests to verify
274274
- [ ] Create application step to execute the playbook

docs/technical/template-system-architecture.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,18 @@ For Ansible templates, the system uses a **hybrid approach** combining static pl
8282
- name: Configure UFW firewall
8383
hosts: all
8484
vars_files:
85-
- variables.yml # Load centralized variables
86-
85+
- variables.yml # Load centralized variables
86+
8787
tasks:
8888
- name: Allow SSH access
8989
community.general.ufw:
90-
port: "{{ ssh_port }}" # Variable from variables.yml
90+
port: "{{ ssh_port }}" # Variable from variables.yml
9191
```
9292
9393
```yaml
9494
# templates/ansible/variables.yml.tera (rendered once)
9595
---
96-
ssh_port: {{ ssh_port }}
96+
ssh_port: { { ssh_port } }
9797
```
9898
9999
## 🔧 Key Components
@@ -106,9 +106,14 @@ ssh_port: {{ ssh_port }}
106106
107107
### Template Renderers
108108
109-
- **OpenTofu Renderer**: Processes infrastructure templates
110-
- **Ansible Renderer**: Processes configuration management templates
111-
- Handle the template → build directory rendering process
109+
The system uses a **Project Generator** pattern (Orchestrator/Worker) to standardize how different tools (OpenTofu, Ansible) generate their project files.
110+
111+
- **Orchestrator (`ProjectGenerator`)**: Manages the overall generation process.
112+
- `OpenTofuProjectGenerator`
113+
- `AnsibleProjectGenerator`
114+
- **Workers (`Renderer`)**: Handle specific file types.
115+
- **Static File Copying**: Copies files without `.tera` extension (requires explicit registration).
116+
- **Dynamic Template Rendering**: Renders `.tera` files with variable substitution (e.g., `InventoryRenderer`, `VariablesRenderer`).
112117

113118
**Two-Phase Processing:**
114119

0 commit comments

Comments
 (0)