# How do you use the set\_stats module?

**URL:** <https://forum.ansible.com/t/how-do-you-use-the-set-stats-module/38928>\
**Category:** Get Help\
**Tags:** playbook\
**Created:** [December 5, 2024, 6:43pm UTC](https://forum.ansible.com/t/how-do-you-use-the-set-stats-module/38928 "2024-12-05T18:43:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpmens](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jpmens/32/5543_2.png) [@jpmens](https://forum.ansible.com/u/jpmens)\
**Post date:** [December 5, 2024, 6:43pm UTC](https://forum.ansible.com/t/how-do-you-use-the-set-stats-module/38928/1 "2024-12-05T18:43:30Z")

</div>

I’m looking for interesting/cute/exciting/novel ways of using Ansible’s [set\_stats](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/set_stats_module.html) module.

Other than _you can use it to count something or other and display it at playbook end_, there’s not much that occurs to me.

What are you using it for?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 5, 2024, 7:08pm UTC](https://forum.ansible.com/t/how-do-you-use-the-set-stats-module/38928/2 "2024-12-05T19:08:03Z")

</div>

The main reason for introducing it was for tower/awx so that variables could be added in a location that could be used in a workflow for subsequent `ansible-playbook` executions. The output from the first execution, is injected into the 2nd using `--extra-vars`.

I have an example of how this works outside of awx:

> <https://gist.github.com/sivel/eaa83e2b1c36719359e0671afa8cd039>

> <https://github.com/sivel/toiletwater/blob/master/plugins/callback/dump_stats.py>

---

<div class="post-metadata">

**Author:** ![jpmens](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jpmens/32/5543_2.png) [@jpmens](https://forum.ansible.com/u/jpmens)\
**Post date:** [December 6, 2024, 4:52pm UTC](https://forum.ansible.com/t/how-do-you-use-the-set-stats-module/38928/3 "2024-12-06T16:52:02Z")

</div>

Very interesting, thank you, Matt.
