-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Description
Thank you for your highly useful and highly readable book on Ansible. I have dog-eared my copy extensively!
In Chapter 11 there is a section named "The fail and assert modules".
It currently says:
Both fail and assert, when triggered, will abort the playbook
run, and the only difference is in the simplicity of their usage.
I humbly suggest amending that to something like:
Both fail and assert, when triggered, will abort the playbook
run. The choice between these two is one of style and simplicity.
One subtle difference is that a 'fail' task will be reported as
'skipped' in the final recap statistics when the failure is not
triggered.
If your playbook contains a single 'fail' task that is happily
not triggered, the playbook results will contain:
PLAY RECAP *********************************************************************
default : .......(snip).... skipped=1
If your playbook instead contains a single 'assert' task that is
happily not triggered, you will see "skipped=0" and the
individual task outcome will be:
TASK [my_assert] ****************************************
ok: [default] => {
"changed": false,
"msg": "All assertions passed"
}
This subtlety about "skipped" task count can be relevant in scenarios where one must audit and justify tasks that have been skipped.
Metadata
Metadata
Assignees
Labels
No labels