Use this when confirming a job really achieved its goal.
Postconditions
Postconditions are checks after an automation job that confirm the intended result, such as the service responding, the config applied or the user existing, before the job reports success.
1. Postconditions verify the intended result.
2. Test service health, not just command success.
3. Rollback or alert on failure.
4. Log evidence.
5. Part of every change.
change → verify postconditions → success or rollback
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Treating exit code 0 as evidence of success.
- Checking the config file but not the running service.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Check the result, not just the exit code.
- Service responding, config applied, object exists.
- Fail if postconditions fail.
- Postcondition checks (service up, config applied) — verification
- Health checks after change — validation
- Automatic rollback on failed postcondition — safety
ReferenceWhy it matters1 section · depth on demand
What it is
Postconditions verify the result after a change: the service is running, the config is present, a health check passes. They turn "the script finished" into "the system is in the intended state".
ReferenceImportant terms & boundaries2 sections · depth on demand
How it works
Write postconditions as checks against the target system, not the automation's own log: query the API or device after the change and compare with the intended values. Run them after every target, so a failure stops the batch before more systems are changed.
Example
- name: Verify service answers
ansible.builtin.uri:
url: https://{{ inventory_hostname }}/health
status_code: 200
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Automation Design > Postconditions. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/well-architected/operational-excellence/enable-automation · confidence 94%