Ansible apt module unable to remove packages not in CURSTATE_INSTALLED
#81154
Labels
affects_2.16
feature
This issue/PR relates to a feature request.
module
This issue/PR relates to a module.
P3
Priority 3 - Approved, No Time Limitation
verified
This issue has been verified/reproduced by maintainer
Summary
The apt module never attempts to remove packages that are in a state other than
CURSTATE_INSTALLED
according toapt_pkg
. This means that packages in any ofCURSTATE_UNPACKED
,CURSTATE_HALF_CONFIGURED
,CURSTATE_HALF_INSTALLED
, orCURSTATE_CONFIG_FILES
cannot be removed using the ansible apt module.All possible states can be seen here, and the state check can be seen here.
This was an issue for us as we had a package with a bad post install script that left the package in
CURSTATE_HALF_CONFIGURED
and were then unable to remove that package with ansible, and were forced to directly invokeapt remove
via the ansiblecommand
module.It may be unexpected behavior by ansible to remove packages in these other states, but at least having a configuration option so that it is possible to remove them would be greatly beneficial.
Issue Type
Feature Idea
Component Name
apt
Additional Information
Adding a configuration option to the
apt
module to allow removal of packages in these other states would allow packages that were badly installed to be removed by the ansibleapt
module. Currently, we have to update our playbook to use the ansiblecommand
module to directly runapt remove
on this package in order to cover the case where the package is badly installed. It would be much better if we could natively use theapt
module to accomplish this.Code of Conduct
The text was updated successfully, but these errors were encountered: