Files
community.general/plugins/modules
Allen Smith b1c75339c0 openbsd_pkg: add support for removing unused dependencies (#10705)
* openbsd_pkg: add support for removing unused dependencies

Add new state 'rm_unused_deps' that uses 'pkg_delete -a' to remove
packages that are no longer required by any other packages.

Features:
- Requires name='*' to avoid accidental usage
- Supports check mode, diff mode, clean and quick flags
- Follows existing module patterns for error handling
- Integrates with existing package list comparison for change detection

* Update the PR number in the frgment link

* Fix the changelog fragment name to include the PR #

* Force non-interactive mode like most of the other modes

* Fix PEP8 E302: add missing blank line before function definition

* Ensure that no matter what, if the package list unchanged then there was no change

Also removed some unused vars from the original code.

* Standardize names in the PR

* Swap over from a new state to implementing an autoremove option

Added code to handle the case where you git a name or list of names as
pkg_delete will correctly filter what it autoremove by the names

* Update the fragment to match the new code

* typo in EXAMPLES

* Fix up a yamllint complaint.

I do note the following:

```
$ ansible-lint tests/test_openbsd_pkg.yml

Passed: 0 failure(s), 0 warning(s) on 1 files. Last profile that met the validation criteria was 'production'.
```

Although that could be due to local config

* While here add realistic examples of packages that might be autoinstalled

* Clean up docs.

Co-authored-by: Felix Fontein <felix@fontein.de>

* Autoremove is an option, work like the other package managers

* Update changelog for openbsd_pkg autoremove parameter

Clarified the behavior of the `autoremove` parameter to specify it removes autoinstalled packages. Removed flowery text that isn't needed.

* Cut the rest of the cruft out of the changelog fragment

Make it obvious how '*' can be used as a 'name:'
Be more pythonic in the package list comparison.

* Update changelogs/fragments/10705-openbsd-pkg-remove-unused.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
2025-08-28 22:09:15 +02:00
..
2024-12-27 14:29:15 +01:00
2024-12-27 14:29:15 +01:00
2024-12-31 12:47:19 +13:00
2024-12-31 12:47:19 +13:00
2025-08-04 19:59:37 +02:00
2024-12-26 21:53:20 +01:00
2024-12-29 13:42:22 +01:00
2024-12-26 21:53:20 +01:00
2024-12-26 21:54:03 +01:00
2024-12-26 21:54:03 +01:00
2024-12-26 21:55:56 +01:00
2024-12-26 21:55:56 +01:00
2025-01-06 21:31:59 +01:00
2024-12-26 09:12:05 +01:00
2025-01-07 06:28:00 +01:00
2025-01-07 06:28:00 +01:00
2024-12-26 13:40:55 +01:00
2025-08-23 18:34:21 +02:00
2024-12-26 13:41:54 +01:00
2025-01-12 13:03:26 +01:00
2025-08-23 18:35:37 +02:00
2025-01-12 13:03:26 +01:00
2024-12-25 22:48:04 +01:00
2024-12-25 21:19:49 +01:00
2024-12-25 21:19:49 +01:00
2025-01-08 20:41:03 +01:00
2024-12-25 21:19:49 +01:00
2025-01-03 22:52:09 +01:00
2024-12-26 08:22:58 +01:00
2025-01-03 20:00:45 +01:00
2024-12-26 08:22:58 +01:00
2024-12-25 09:48:22 +01:00
2025-06-16 20:06:03 +02:00
2025-01-04 11:04:51 +01:00
2024-12-24 12:00:30 +01:00
2025-01-04 11:04:51 +01:00
2024-12-23 09:28:05 +01:00
2024-12-29 00:25:12 +01:00
2024-12-23 18:58:02 +01:00
2025-06-28 13:04:28 +02:00
2025-01-04 12:29:34 +13:00