modules/apt: add support for apt-patterns #83070
Open
+12
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
This small patch adds support for apt-patterns.
ISSUE TYPE
ADDITIONAL INFORMATION
Support for apt-patterns makes it possible e.g. to express
apt purge ?config-files
using theapt
module in contrast to working around usingshell
.Only when using
state=absent
, the apt-pattern will end up as-is in the final call to apt on the remote machine as this is the most relevant use case for us and also in the examples of the apt-patterns man page. It is certainly possible to generalize for other packages states if required.Example call:
ansible -m apt -a "name=?config-files state=absent autoremove=yes purge=yes" ...
will purge remnant configuration files from removed packages as well as unused packages in one call.