8000 homebrew: tasks fails state=absent for unknown packages · Issue #9811 · ansible-collections/community.general · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
homebrew: tasks fails state=absent for unknown packages #9811
Open
@brad2014

Description

@brad2014

Summary

Ansible's package managers like ansible.builtin.dnf do not fail when a package that is unknown to the package manager (given the repos present on that at a given moment) is asserted to be absent.

This succeeds on ansible.builtin.dnf, fails on community.general.homebrew.

- package:
    name: thispackagedoesnotexist 
    state: absent 

Issue Type

Feature Idea

Component Name

homebrew

Ansible Version

$ ansible --version
ansible [core 2.18.3]
  config file = /Users/brad/Projects/ansible/ansible.cfg
  configured module search path = ['/Users/brad/Projects/ansible/homelab/roles/library', '/Users/brad/Projects/ansible/homelab/roles/network/library']
  ansible python module location = /Users/brad/Projects/ansible/.venv/lib/python3.13/site-packages/ansible
  ansible collection location = /Users/brad/Projects/ansible/collections
  executable location = /Users/brad/Projects/ansible/.venv/bin/ansible
  python version = 3.13.2 (main, Feb  4 2025, 14:51:09) [Clang 16.0.0 (clang-1600.0.26.6)] (/Users/brad/Projects/ansible/.venv/bin/python3.13)
  jinja version = 3.1.5
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general
...
community.general 10.3.1 

Configuration

$ ansible-config dump --only-changed

OS / Environment

MacOS Sonoma 14.5

Steps to Reproduce

Expected Results

As a matter of semantics, we expect that a package that does not exist is absent.

As a matter of practicality, we expect to be able to run this task on a number of machines, some having the tap that provides the package, some not, and have the playbook run successfully (as we do on DNF based machines).

Actual Results

TASK [package] *****************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error: No available formula with the name \"thispackagedoesnotexist\"."}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    callbackcallback pluginfeatureThis issue/PR relates to a feature requestmodulemodulepluginsplugin (any type)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0