@ -196,6 +196,13 @@ options:
- Has an effect only if I ( download_only ) is specified .
- Has an effect only if I ( download_only ) is specified .
type : str
type : str
version_added : " 2.8 "
version_added : " 2.8 "
allowerasing :
description :
- If C ( yes ) it allows erasing of installed packages to resolve dependencies .
required : false
type : bool
default : " no "
version_added : " 2.10 "
notes :
notes :
- When used with a ` loop : ` each package will be processed individually , it is much more efficient to pass the list directly to the ` name ` option .
- When used with a ` loop : ` each package will be processed individually , it is much more efficient to pass the list directly to the ` name ` option .
- Group removal doesn ' t work if the group was installed with Ansible because
- Group removal doesn ' t work if the group was installed with Ansible because
@ -325,6 +332,9 @@ class DnfModule(YumDnf):
except AttributeError :
except AttributeError :
self . with_modules = False
self . with_modules = False
# DNF specific args that are not part of YumDnf
self . allowerasing = self . module . params [ ' allowerasing ' ]
def is_lockfile_pid_valid ( self ) :
def is_lockfile_pid_valid ( self ) :
# FIXME? it looks like DNF takes care of invalid lock files itself?
# FIXME? it looks like DNF takes care of invalid lock files itself?
# https://github.com/ansible/ansible/issues/57189
# https://github.com/ansible/ansible/issues/57189
@ -866,7 +876,6 @@ class DnfModule(YumDnf):
return False # seems like a sane default
return False # seems like a sane default
def ensure ( self ) :
def ensure ( self ) :
allow_erasing = False
response = {
response = {
' msg ' : " " ,
' msg ' : " " ,
@ -1119,13 +1128,13 @@ class DnfModule(YumDnf):
# Like the dnf CLI we want to allow recursive removal of dependent
# Like the dnf CLI we want to allow recursive removal of dependent
# packages
# packages
allow _ erasing = True
self . allow erasing = True
if self . autoremove :
if self . autoremove :
self . base . autoremove ( )
self . base . autoremove ( )
try :
try :
if not self . base . resolve ( allow_erasing = allow _ erasing) :
if not self . base . resolve ( allow_erasing = self . allow erasing) :
if failure_response [ ' failures ' ] :
if failure_response [ ' failures ' ] :
failure_response [ ' msg ' ] = ' Failed to install some of the specified packages '
failure_response [ ' msg ' ] = ' Failed to install some of the specified packages '
self . module . fail_json ( * * failure_response )
self . module . fail_json ( * * failure_response )
@ -1258,6 +1267,10 @@ def main():
# list=repos
# list=repos
# list=pkgspec
# list=pkgspec
# Extend yumdnf_argument_spec with dnf-specific features that will never be
# backported to yum because yum is now in "maintenance mode" upstream
yumdnf_argument_spec [ ' argument_spec ' ] [ ' allowerasing ' ] = dict ( default = False , type = ' bool ' )
module = AnsibleModule (
module = AnsibleModule (
* * yumdnf_argument_spec
* * yumdnf_argument_spec
)
)