freeipa / ansible-freeipa

Ansible roles and modules for FreeIPA
GNU General Public License v3.0
499 stars 232 forks source link

Gather required facts if relevant keys in ansible_facts are missing #1102

Closed spike77453 closed 8 months ago

spike77453 commented 1 year ago

This adds an additional tasks to gather relevant facts if the corresponding keys (i.e. distribution, distribution_version, distribution_major_version, os_family) are not already present in the ansible_facts dict.

Since the documentation does not mention that fact gathering is required before using certain roles, this prevents errors such as https://github.com/freeipa/ansible-freeipa/issues/962

One could also add when: ansible_facts_fqdn is not defined ....
However, this is not always required (e.g. when using the role ipaclient only tasks/install.yml uses ansible_facts.fqdn) and ansible_facts.fqdn will always be preset after using ansible.builtin.setup with gather_subset: min.

rjeffman commented 8 months ago

Closing this in favor of #1205 with a more strict data retrieval.

Thank you for raising the issue.