Play Recap and Return Values
My Experience with Ansible Recap and Return Values
Understanding the Ansible Play Recap
PLAY RECAP *************************************************************************
web-server1 : ok=5 changed=2 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
db-server1 : ok=4 changed=1 unreachable=0 failed=0 skipped=2 rescued=0 ignored=0
windows-server1 : ok=6 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0The Different Status Types in Play Recap
Ok Status
Changed Status
Unreachable Status
Failed Status
Skipped Status
Rescued Status
Ignored Status
Working with Return Values
Capturing Return Values with Register
Common Return Values
Changed Status
Return Code (rc)
stdout and stderr
Powerful Windows Example: Working with PowerShell Return Values
Linux Example: Advanced Usage with Conditionals
Understanding the Flow of Return Values
Best Practices I've Learned
1. Always Handle Errors Appropriately
2. Use Changed_When to Control Changed Status
3. Utilize Failed_When for Custom Failure Conditions
4. Leverage JSON Return Values
5. Use "when" Statements with Return Values for Conditional Execution
Common Pitfalls to Avoid
Conclusion
Last updated