lonix
lonix

Reputation: 20609

Get number of current failed/skipped/ok tasks in ansible play

How can I determine how many "changed", "skipped", "ok" tasks have run so far?

Surely this information is available, because at the end of the run, ansible shows the "play recap".

I found nothing in "special variables".

Upvotes: 2

Views: 932

Answers (1)

Thor
Thor

Reputation: 240

I guess it depends on what you're trying to do with that.

The number of changed, skipped, failed, rescued and so on tasks is stored in stats, which is set interally by using the module set_stats. This is passed along in the standard callback plugin in v2_playbook_on_stats, which you can override/extend by creating your own stdout_callback plugin. Thus, if you'd like, you could have a running tally of the stats.

However, if you wish to use it during a playbook, I'd first ask what you're trying to accomplish with that. I haven't seen any resources on reading data set with set_stats yet.

Upvotes: 2

Related Questions