Pcornel
Automation

Templates

Cheat sheet · https://pcornel.dk/topic.php?topic=5805

Back to the Topic

Answer

Templates in automation generate configuration files, device configs or messages from a template plus variables, typically with Jinja2, so one tested pattern produces many consistent outputs.

Remember

  • Separate structure (template) from data (variables).
  • Fail on undefined variables.
  • Validate rendered output before deploying.

First checks

  • Template files in git — versioned
  • python3 -c "import jinja2;print(jinja2.__version__)" — engine
  • Rendered output validation — correctness

Verify in this order

data + template → render → validate → deploy

Where it usually breaks

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5805

Confirmation

Confirm action

Continue?