Skip to content

Multiple Deprecation Warnings Related to INJECT_FACTS_AS_VARS and  bool  Filter in macOS Roles #237

@nzkller

Description

@nzkller

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions