Retrieving facts in 2.4

Looks like a huge refactor of Facts and Fact gather took place in 2.4?

commit 45a9f967749ec68e2077fe1d1d32dd37660ab376

How do I get Facts inside my module after the refactoring?

I used to use Facts(module) but that’s gone.

I see Ansible’s own modules suffer from this change as well?

https://github.com/ansible/ansible/issues/25289

Thanks.

Ideally any facts needed by the module would be passed in task args.

How is the Facts(module) instance being used?

Previously, running Facts(module) in a module would result in
gathering all the facts again (if they had previously been collected
in setup...).

If you need to rerun some subset of facts (for example, to get user
facts like ansible_user_shell), you can use the particular fact
collector
(ansible.module_utils.facts.system.user.UserFactCollector for this example).

I have a pr to fix 'hostname' module up at
https://github.com/ansible/ansible/pull/25316
As far as I could tell, it should be the only ansible module using the
Facts() class directly.

I wasnt planning on preserving the Facts() API, but I could add a
compat layer back if needed.
Point me at the code that is using it and I'll take a look.

Ideally any facts needed by the module would be passed in task args.

How is the Facts(module) instance being used?

Private module for a silly game I host and I patterned my module after the hostname module so it’s why I suffer the same “problem”.

I wasnt planning on preserving the Facts() API, but I could add a
compat layer back if needed.
Point me at the code that is using it and I’ll take a look.

I will learn the new way and I’ll look at your PR on how to fix my problem.

Thanks.