parent
456b4ace7b
commit
7966beb6c9
1 changed files with 38 additions and 36 deletions
|
@ -108,7 +108,7 @@ options:
|
||||||
version_added: "1.6"
|
version_added: "1.6"
|
||||||
autoremove:
|
autoremove:
|
||||||
description:
|
description:
|
||||||
- If C(yes), remove unused dependency packages for all module states except I(build-dep).
|
- If C(yes), remove unused dependency packages for all module states except I(build-dep). It can also be used as the only option.
|
||||||
required: false
|
required: false
|
||||||
default: no
|
default: no
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
|
@ -393,6 +393,7 @@ def expand_pkgspec_from_fnmatches(m, pkgspec, cache):
|
||||||
# a PR to add some sort of explicit regex matching:
|
# a PR to add some sort of explicit regex matching:
|
||||||
# https://github.com/ansible/ansible-modules-core/issues/1258
|
# https://github.com/ansible/ansible-modules-core/issues/1258
|
||||||
new_pkgspec = []
|
new_pkgspec = []
|
||||||
|
if pkgspec:
|
||||||
for pkgspec_pattern in pkgspec:
|
for pkgspec_pattern in pkgspec:
|
||||||
pkgname_pattern, version = package_split(pkgspec_pattern)
|
pkgname_pattern, version = package_split(pkgspec_pattern)
|
||||||
|
|
||||||
|
@ -790,7 +791,7 @@ def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
state = dict(default='present', choices=['installed', 'latest', 'removed', 'absent', 'present', 'build-dep']),
|
state = dict(default='present', choices=['installed', 'latest', 'removed', 'absent', 'present', 'build-dep']),
|
||||||
update_cache = dict(default=False, aliases=['update-cache'], type='bool'),
|
update_cache = dict(aliases=['update-cache'], type='bool'),
|
||||||
cache_valid_time = dict(type='int', default=0),
|
cache_valid_time = dict(type='int', default=0),
|
||||||
purge = dict(default=False, type='bool'),
|
purge = dict(default=False, type='bool'),
|
||||||
package = dict(default=None, aliases=['pkg', 'name'], type='list'),
|
package = dict(default=None, aliases=['pkg', 'name'], type='list'),
|
||||||
|
@ -800,12 +801,12 @@ def main():
|
||||||
force = dict(default='no', type='bool'),
|
force = dict(default='no', type='bool'),
|
||||||
upgrade = dict(choices=['no', 'yes', 'safe', 'full', 'dist']),
|
upgrade = dict(choices=['no', 'yes', 'safe', 'full', 'dist']),
|
||||||
dpkg_options = dict(default=DPKG_OPTIONS),
|
dpkg_options = dict(default=DPKG_OPTIONS),
|
||||||
autoremove = dict(type='bool', default=False, aliases=['autoclean']),
|
autoremove = dict(type='bool', aliases=['autoclean']),
|
||||||
only_upgrade = dict(type='bool', default=False),
|
only_upgrade = dict(type='bool', default=False),
|
||||||
allow_unauthenticated = dict(default='no', aliases=['allow-unauthenticated'], type='bool'),
|
allow_unauthenticated = dict(default='no', aliases=['allow-unauthenticated'], type='bool'),
|
||||||
),
|
),
|
||||||
mutually_exclusive = [['package', 'upgrade', 'deb']],
|
mutually_exclusive = [['package', 'upgrade', 'deb']],
|
||||||
required_one_of = [['package', 'upgrade', 'update_cache', 'deb']],
|
required_one_of = [['package', 'upgrade', 'update_cache', 'deb', 'autoremove']],
|
||||||
supports_check_mode = True
|
supports_check_mode = True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -911,6 +912,7 @@ def main():
|
||||||
|
|
||||||
packages = p['package']
|
packages = p['package']
|
||||||
latest = p['state'] == 'latest'
|
latest = p['state'] == 'latest'
|
||||||
|
if packages:
|
||||||
for package in packages:
|
for package in packages:
|
||||||
if package.count('=') > 1:
|
if package.count('=') > 1:
|
||||||
module.fail_json(msg="invalid package spec: %s" % package)
|
module.fail_json(msg="invalid package spec: %s" % package)
|
||||||
|
|
Loading…
Reference in a new issue