Improving ansible facts documentation

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.

@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

3 Likes

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 :grin:

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?

3 Likes

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