|
|
@ -29,6 +29,8 @@ options:
|
|
|
|
When using state=latest, this can be '*' which means run: dnf -y update.
|
|
|
|
When using state=latest, this can be '*' which means run: dnf -y update.
|
|
|
|
You can also pass a url or a local path to a rpm file."
|
|
|
|
You can also pass a url or a local path to a rpm file."
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
|
|
|
|
|
aliases:
|
|
|
|
|
|
|
|
- pkg
|
|
|
|
|
|
|
|
|
|
|
|
list:
|
|
|
|
list:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -37,7 +39,7 @@ options:
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Whether to install (C(present), C(latest)), or remove (C(absent)) a package.
|
|
|
|
- Whether to install (C(present), C(latest)), or remove (C(absent)) a package.
|
|
|
|
choices: [ "present", "latest", "absent" ]
|
|
|
|
choices: ['absent', 'present', 'installed', 'removed', 'latest']
|
|
|
|
default: "present"
|
|
|
|
default: "present"
|
|
|
|
|
|
|
|
|
|
|
|
enablerepo:
|
|
|
|
enablerepo:
|
|
|
@ -84,6 +86,7 @@ options:
|
|
|
|
installed as dependencies of user-installed packages but which are no longer
|
|
|
|
installed as dependencies of user-installed packages but which are no longer
|
|
|
|
required by any such package. Should be used alone or when state is I(absent)
|
|
|
|
required by any such package. Should be used alone or when state is I(absent)
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
|
|
|
|
default: false
|
|
|
|
version_added: "2.4"
|
|
|
|
version_added: "2.4"
|
|
|
|
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.
|
|
|
@ -326,7 +329,7 @@ def ensure(module, base, state, names, autoremove):
|
|
|
|
|
|
|
|
|
|
|
|
# Autoremove is called alone
|
|
|
|
# Autoremove is called alone
|
|
|
|
# Jump to remove path where base.autoremove() is run
|
|
|
|
# Jump to remove path where base.autoremove() is run
|
|
|
|
if not names and autoremove is not None:
|
|
|
|
if not names and autoremove:
|
|
|
|
names = []
|
|
|
|
names = []
|
|
|
|
state = 'absent'
|
|
|
|
state = 'absent'
|
|
|
|
|
|
|
|
|
|
|
@ -412,7 +415,7 @@ def ensure(module, base, state, names, autoremove):
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# state == absent
|
|
|
|
# state == absent
|
|
|
|
if autoremove is not None:
|
|
|
|
if autoremove:
|
|
|
|
base.conf.clean_requirements_on_remove = autoremove
|
|
|
|
base.conf.clean_requirements_on_remove = autoremove
|
|
|
|
|
|
|
|
|
|
|
|
if filenames:
|
|
|
|
if filenames:
|
|
|
@ -480,15 +483,16 @@ def main():
|
|
|
|
argument_spec=dict(
|
|
|
|
argument_spec=dict(
|
|
|
|
name=dict(aliases=['pkg'], type='list'),
|
|
|
|
name=dict(aliases=['pkg'], type='list'),
|
|
|
|
state=dict(
|
|
|
|
state=dict(
|
|
|
|
choices=[
|
|
|
|
choices=['absent', 'present', 'installed', 'removed', 'latest'],
|
|
|
|
'absent', 'present', 'installed', 'removed', 'latest']),
|
|
|
|
default='present',
|
|
|
|
|
|
|
|
),
|
|
|
|
enablerepo=dict(type='list', default=[]),
|
|
|
|
enablerepo=dict(type='list', default=[]),
|
|
|
|
disablerepo=dict(type='list', default=[]),
|
|
|
|
disablerepo=dict(type='list', default=[]),
|
|
|
|
list=dict(),
|
|
|
|
list=dict(),
|
|
|
|
conf_file=dict(default=None, type='path'),
|
|
|
|
conf_file=dict(default=None, type='path'),
|
|
|
|
disable_gpg_check=dict(default=False, type='bool'),
|
|
|
|
disable_gpg_check=dict(default=False, type='bool'),
|
|
|
|
installroot=dict(default='/', type='path'),
|
|
|
|
installroot=dict(default='/', type='path'),
|
|
|
|
autoremove=dict(type='bool'),
|
|
|
|
autoremove=dict(type='bool', default=False),
|
|
|
|
releasever=dict(default=None),
|
|
|
|
releasever=dict(default=None),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
required_one_of=[['name', 'list', 'autoremove']],
|
|
|
|
required_one_of=[['name', 'list', 'autoremove']],
|
|
|
@ -499,7 +503,7 @@ def main():
|
|
|
|
_ensure_dnf(module)
|
|
|
|
_ensure_dnf(module)
|
|
|
|
|
|
|
|
|
|
|
|
# Check if autoremove is called correctly
|
|
|
|
# Check if autoremove is called correctly
|
|
|
|
if params['autoremove'] is not None:
|
|
|
|
if params['autoremove']:
|
|
|
|
if LooseVersion(dnf.__version__) < LooseVersion('2.0.1'):
|
|
|
|
if LooseVersion(dnf.__version__) < LooseVersion('2.0.1'):
|
|
|
|
module.fail_json(msg="Autoremove requires dnf>=2.0.1. Current dnf version is %s" % dnf.__version__)
|
|
|
|
module.fail_json(msg="Autoremove requires dnf>=2.0.1. Current dnf version is %s" % dnf.__version__)
|
|
|
|
if params['state'] not in ["absent", None]:
|
|
|
|
if params['state'] not in ["absent", None]:
|
|
|
|