Summary
In the investigation of an ansible performance problem related to facts (ansible/ansible#73654) , it was found that having INJECT_FACTS_AS_VARS set to true (which is the default) can lead to a performance impact when processing result. The larger the amount of host facts, the longer task result processing takes. It would be beneficial to warn if someone is relying on these facts. Since it's dynamic, it might be difficult to determine which vars, but there are common ones like ansible_distribution* or ansible_{hostname,fqdn,nodename,os}
Additionally it might be beneficial to warn about an unfiltered setup module call as pulling in all the facts can have unintended performance issues.
Related changes: https://review.opendev.org/q/owner:aschultz%2540redhat.com+topic:ansible-facts
Issue Type
STEPS TO FIND SIMILAR VARS
I found our usage of these things by looking in our yaml files with something like:
grep ansible_ * -r | egrep -v "_(facts|become|user|host|limit|check_mode|ssh|connection|managed|verbose|job|home|log|loop|async|limit|filter|version|_inventory|\.py|group_vars)" | grep ansible_
Desired Behaviour
Warn when things like ansible_hostname, ansible_fqdn, ansible_distribution, etc are used.
Summary
In the investigation of an ansible performance problem related to facts (ansible/ansible#73654) , it was found that having INJECT_FACTS_AS_VARS set to true (which is the default) can lead to a performance impact when processing result. The larger the amount of host facts, the longer task result processing takes. It would be beneficial to warn if someone is relying on these facts. Since it's dynamic, it might be difficult to determine which vars, but there are common ones like ansible_distribution* or ansible_{hostname,fqdn,nodename,os}
Additionally it might be beneficial to warn about an unfiltered setup module call as pulling in all the facts can have unintended performance issues.
Related changes: https://review.opendev.org/q/owner:aschultz%2540redhat.com+topic:ansible-facts
Issue Type
STEPS TO FIND SIMILAR VARS
I found our usage of these things by looking in our yaml files with something like:
grep ansible_ * -r | egrep -v "_(facts|become|user|host|limit|check_mode|ssh|connection|managed|verbose|job|home|log|loop|async|limit|filter|version|_inventory|\.py|group_vars)" | grep ansible_Desired Behaviour
Warn when things like ansible_hostname, ansible_fqdn, ansible_distribution, etc are used.