You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,13 +87,15 @@ These principles should guide all development decisions, code reviews, and featu
87
87
88
88
4.**Before working with Tera templates**: Read [`docs/contributing/templates.md`](../docs/contributing/templates.md) for correct variable syntax - use `{{ variable }}` not `{ { variable } }`. Tera template files have the `.tera` extension.
89
89
90
-
5.**When handling errors in code**: Read [`docs/contributing/error-handling.md`](../docs/contributing/error-handling.md) for error handling principles. Prefer explicit enum errors over anyhow for better pattern matching and user experience. Make errors clear, include sufficient context for traceability, and ensure they are actionable with specific fix instructions.
90
+
5.**When adding new Ansible playbooks**: Read [`docs/contributing/templates.md`](../docs/contributing/templates.md) for the complete guide. **CRITICAL**: Static playbooks (without `.tera` extension) must be registered in `src/infrastructure/external_tools/ansible/template/renderer/mod.rs` in the `copy_static_templates` method, otherwise they won't be copied to the build directory and Ansible will fail with "playbook not found" error.
91
91
92
-
6.**Understanding expected errors**: Read [`docs/contributing/known-issues.md`](../docs/contributing/known-issues.md) for known issues and expected behaviors. Some errors that appear red in E2E test output (like SSH host key warnings) are normal and expected - not actual failures.
92
+
6.**When handling errors in code**: Read [`docs/contributing/error-handling.md`](../docs/contributing/error-handling.md) for error handling principles. Prefer explicit enum errors over anyhow for better pattern matching and user experience. Make errors clear, include sufficient context for traceability, and ensure they are actionable with specific fix instructions.
93
93
94
-
7.**Before making engineering decisions**: Document significant architectural or design decisions as Architectural Decision Records (ADRs) in `docs/decisions/`. Read [`docs/decisions/README.md`](../docs/decisions/README.md) for the ADR template and guidelines. This ensures decisions are properly documented with context, rationale, and consequences for future reference.
94
+
7.**Understanding expected errors**: Read [`docs/contributing/known-issues.md`](../docs/contributing/known-issues.md) for known issues and expected behaviors. Some errors that appear red in E2E test output (like SSH host key warnings) are normal and expected - not actual failures.
95
95
96
-
8.**When organizing code within modules**: Follow the module organization conventions in [`docs/contributing/module-organization.md`](../docs/contributing/module-organization.md). Use top-down organization with public items first, high-level abstractions before low-level details, and important responsibilities before secondary concerns like error types.
96
+
8.**Before making engineering decisions**: Document significant architectural or design decisions as Architectural Decision Records (ADRs) in `docs/decisions/`. Read [`docs/decisions/README.md`](../docs/decisions/README.md) for the ADR template and guidelines. This ensures decisions are properly documented with context, rationale, and consequences for future reference.
97
+
98
+
9.**When organizing code within modules**: Follow the module organization conventions in [`docs/contributing/module-organization.md`](../docs/contributing/module-organization.md). Use top-down organization with public items first, high-level abstractions before low-level details, and important responsibilities before secondary concerns like error types.
After applying the fix, manually correct any existing formatting issues in your `.tera` files by removing the spaces inside the curly braces.
95
+
96
+
## 📦 Adding New Ansible Playbooks
97
+
98
+
When adding new Ansible playbooks to the project, you need to understand the difference between **static playbooks** and **dynamic templates**, and follow the correct registration process.
99
+
100
+
### Static vs Dynamic Playbooks
101
+
102
+
#### Static Playbooks (No Tera Variables)
103
+
104
+
Static playbooks are standard Ansible YAML files that don't require variable substitution:
105
+
106
+
-**No `.tera` extension** - Just `.yml`
107
+
-**No Tera variables** - No `{{ variable }}` syntax needed
108
+
-**Direct copy** - Copied as-is from `templates/ansible/` to `build/` directory
❌ **Forgetting to register the playbook** in `copy_static_templates`
246
+
247
+
- Error: Playbook not found during execution
248
+
- Fix: Add playbook name to the array
249
+
250
+
❌ **Forgetting to update the file count** in debug log
251
+
252
+
- Error: Confusing logs during debugging
253
+
- Fix: Update the count comment
254
+
255
+
❌ **Using `.tera` extension for static playbooks**
256
+
257
+
- Error: Unnecessary complexity
258
+
- Fix: Only use `.tera` if you need variable substitution
259
+
260
+
❌ **Adding dynamic variables without `.tera` extension**
261
+
262
+
- Error: Variables not resolved, literal `{{ variable }}` in output
263
+
- Fix: Rename to `.yml.tera` and handle in rendering phase
264
+
265
+
### Quick Checklist
266
+
267
+
When adding a static Ansible playbook:
268
+
269
+
- [ ] Create `.yml` file in `templates/ansible/`
270
+
- [ ] 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`
272
+
- [ ] Update file count in debug log
273
+
- [ ] Run E2E tests to verify
274
+
- [ ] Create application step to execute the playbook
275
+
- [ ] Verify playbook appears in `build/` directory during execution
276
+
277
+
### Related Documentation
278
+
279
+
- **Architecture**: [`docs/technical/template-system-architecture.md`](../technical/template-system-architecture.md) - Understanding the two-phase template system
280
+
- **Tera Syntax**: This document (above) - When you DO need dynamic templates with variables
281
+
- **Testing**: [`docs/e2e-testing.md`](../e2e-testing.md) - How to run E2E tests to validate your changes
0 commit comments