# Improving ansible facts documentation

**URL:** <https://forum.ansible.com/t/improving-ansible-facts-documentation/40075>\
**Category:** Project Discussions\
**Created:** [February 5, 2025, 9:49am UTC](https://forum.ansible.com/t/improving-ansible-facts-documentation/40075 "2025-02-05T09:49:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gundalow](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/gundalow/32/99_2.png) [@gundalow](https://forum.ansible.com/u/gundalow)\
**Post date:** [February 5, 2025, 9:49am UTC](https://forum.ansible.com/t/improving-ansible-facts-documentation/40075/1 "2025-02-05T09:49:44Z")

</div>

During CfgMgmtCamp & Contributors Summit 2025 in Ghent there was a lot of discussion around set\_facts. One of the actions we took was to improve the documentation.

- [using variable documentation](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html)
  - Detail the anti patterns (how not to use set\_facts)
  - Some real world examples (not made up examples)
  - Link back to set\_facts & [ansible variable precedence page](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence)
  - Related URL: [Controlling how Ansible behaves: precedence rules — Ansible Community Documentation](https://docs.ansible.com/ansible/latest/reference_appendices/general_precedence.html)

@felixfontein suggested

> maybe we should add an action plugin ‘evaluate’ that evalutes an expression and allows you to register the result and use that, instead of returning `ansible_facts` (like `set_facts`). then you can add an evaluate task, evaluate all expressions there (optionally with `run_once: true`) to get the values evaluated at this point in time, register the result, and then use the result in `vars:`

@Thulium-Drake@kks Thanks for offering to help with this.

Related presentation

> [@Sharing my presentation on applying SOLID principles when developing Ansible content](https://forum.ansible.com/t/sharing-my-presentation-on-applying-solid-principles-when-developing-ansible-content/6837):
>
> Recently I had a pleasure of presenting at DevConf.cz. Below is abstract you can find all talk materials at [bit.ly/solid-ansible](https://bit.ly/solid-ansible) " Discover how the fundamental principles of SOLID—Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion—can significantly elevate your Ansible role and playbook development. Join us for a session that delves into the practical application of SOLID principles within the realm of Ansible content creation. Through in…

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [February 5, 2025, 9:55am UTC](https://forum.ansible.com/t/improving-ansible-facts-documentation/40075/2 "2025-02-05T09:55:21Z")

</div>

No worries! I’m going into this quite blank (I do know how to write roles etc), but I personally feel that the way I document my code could use a lot of improvements, and I think some of the questions I have will be related to the gaps we see now.

And who’s better suited to write a document on how to document 😁

---

<div class="post-metadata">

**Author:** ![smeeus](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/smeeus/32/7489_2.png) [@smeeus](https://forum.ansible.com/u/smeeus)\
**Post date:** [February 5, 2025, 10:05am UTC](https://forum.ansible.com/t/improving-ansible-facts-documentation/40075/3 "2025-02-05T10:05:26Z")

</div>

For a real life example, would the use case of where I used set\_fact in a loop (and finally running out of physical memory) be a good example of how not to do it?

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [February 5, 2025, 12:41pm UTC](https://forum.ansible.com/t/improving-ansible-facts-documentation/40075/4 "2025-02-05T12:41:57Z")

</div>

That is a great example. There is always not enough content how not to do something.
