Multiple Deprecation Warnings Related to INJECT_FACTS_AS_VARS and bool Filter in macOS Roles
When running playbooks using the elliotweiser.osx-command-line-tools and geerlingguy.mac.homebrew roles, a large number of deprecation warnings appear related to: • The upcoming removal of automatic injection of top-level facts with the ansible_ prefix in Ansible core 2.24 • The deprecated usage of the bool filter coercing invalid list values (empty list) to False, to be removed in Ansible core 2.23
These warnings indicate that variables like ansible_distribution , ansible_distribution_version , ansible_user_id , ansible_machine are used as top-level variables but will soon require accessing via ansible_facts"fact_name" syntax instead. Additionally, the use of | bool on potentially empty lists triggers a separate deprecation.
Examples of warnings and affected lines: • when: ansible_distribution != 'MacOSX' (osx-command-line-tools, main.yml line 7) • when: ansible_distribution_version is version('10.15', '<') and '>=' (osx-command-line-tools, main.yml lines 55 and 74) • homebrew_user: '{{ homebrew_user | default(ansible_user_id) }}' (homebrew, tasks/main.yml lines 4-5) • when: ansible_machine == 'arm64' or != 'arm64' (homebrew, tasks/main.yml lines 14 and 101) • become: "{{ (homebrew_user != ansible_user_id) | bool }}" (homebrew, tasks/main.yml line 119) • Multiple use cases of owner , group , and paths referencing these variables throughout the homebrew tasks.
Impact: • These deprecations will cause playbooks to break or malfunction when upgrading to Ansible core 2.23/2.24 and later. • Current role code is incompatible with upcoming Ansible versions without updates to variable references.
Additional details: • This affects both elliotweiser.osx-command-line-tools (at least tasks/main.yml) and geerlingguy.mac.homebrew roles.
Would appreciate guidance or updates to ensure these widely used roles remain compatible with near-future Ansible core versions.
Environment: • Ansible Core version: 2.20.0 • python version = 3.14.0 (main, Oct 7 2025, 09:34:52) [Clang 17.0.0 (clang-1700.0.13.3)] • jinja version = 3.1.6 • pyyaml version = 6.0.3 (with libyaml v0.2.5) • community.general collection version: 12.0.1 • OS: MacOS 15.6.1 (24G90)
Please let me know if any additional information or logs are needed.
Thank you in advance and best regards.
Yeah, Ansible recently updated to start throwing these warnings, and they're quite annoying.
I have been slowly fixing them in playbooks, but right now I am still trying to hit them when I can.
See: https://github.com/geerlingguy/ansible-collection-mac/commit/9422d80fee39a147eb4340237b5bf9410a4f5eb0
For the upstream role... https://github.com/elliotweiser/ansible-osx-command-line-tools — it hasn't had a commit in a few years, but maybe @elliotweiser could be convinced to accept a PR with just the quick facts fixes?
In the following days I'll try to submit a PR for these changes. I'll keep you posted.
Thanks again!!