geerlingguy / geerlingguy/mac-dev-playbook
Multiple Deprecation Warnings Related to INJECT_FACTS_AS_VARS and bool Filter in macOS Roles
- Dominant language
- Shell
- Stars
- 7k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the warnings with the elliotweiser.osx-command-line-tools tasks/main.yml and geerlingguy.mac.homebrew tasks/main.yml files, focusing on the referenced lines using ansible_distribution, ansible_user_id, ansible_machine, and bool. Update the affected references for upcoming Ansible core versions and verify that the playbook runs without these deprecation warnings on the stated macOS setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100