|
|
@ -44,9 +44,9 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: no
|
|
|
|
default: no
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
|
no-suggests:
|
|
|
|
no-recommends:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Corresponds to the C(--no-suggests) option for I(urpmi).
|
|
|
|
- Corresponds to the C(--no-recommends) option for I(urpmi).
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: yes
|
|
|
|
default: yes
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
@ -130,7 +130,7 @@ def remove_packages(module, packages):
|
|
|
|
module.exit_json(changed=False, msg="package(s) already absent")
|
|
|
|
module.exit_json(changed=False, msg="package(s) already absent")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def install_packages(module, pkgspec, force=True, no_suggests=True):
|
|
|
|
def install_packages(module, pkgspec, force=True, no_recommends=True):
|
|
|
|
|
|
|
|
|
|
|
|
packages = ""
|
|
|
|
packages = ""
|
|
|
|
for package in pkgspec:
|
|
|
|
for package in pkgspec:
|
|
|
@ -138,17 +138,17 @@ def install_packages(module, pkgspec, force=True, no_suggests=True):
|
|
|
|
packages += "'%s' " % package
|
|
|
|
packages += "'%s' " % package
|
|
|
|
|
|
|
|
|
|
|
|
if len(packages) != 0:
|
|
|
|
if len(packages) != 0:
|
|
|
|
if no_suggests:
|
|
|
|
if no_recommends:
|
|
|
|
no_suggests_yes = '--no-suggests'
|
|
|
|
no_recommends_yes = '--no-recommends'
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
no_suggests_yes = ''
|
|
|
|
no_recommends_yes = ''
|
|
|
|
|
|
|
|
|
|
|
|
if force:
|
|
|
|
if force:
|
|
|
|
force_yes = '--force'
|
|
|
|
force_yes = '--force'
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
force_yes = ''
|
|
|
|
force_yes = ''
|
|
|
|
|
|
|
|
|
|
|
|
cmd = ("%s --auto %s --quiet %s %s" % (URPMI_PATH, force_yes, no_suggests_yes, packages))
|
|
|
|
cmd = ("%s --auto %s --quiet %s %s" % (URPMI_PATH, force_yes, no_recommends_yes, packages))
|
|
|
|
|
|
|
|
|
|
|
|
rc, out, err = module.run_command(cmd)
|
|
|
|
rc, out, err = module.run_command(cmd)
|
|
|
|
|
|
|
|
|
|
|
@ -172,7 +172,7 @@ def main():
|
|
|
|
state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']),
|
|
|
|
state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']),
|
|
|
|
update_cache = dict(default=False, aliases=['update-cache'], type='bool'),
|
|
|
|
update_cache = dict(default=False, aliases=['update-cache'], type='bool'),
|
|
|
|
force = dict(default=True, type='bool'),
|
|
|
|
force = dict(default=True, type='bool'),
|
|
|
|
no_suggests = dict(default=True, aliases=['no-suggests'], type='bool'),
|
|
|
|
no_recommends = dict(default=True, aliases=['no-recommends'], type='bool'),
|
|
|
|
package = dict(aliases=['pkg', 'name'], required=True)))
|
|
|
|
package = dict(aliases=['pkg', 'name'], required=True)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -182,7 +182,7 @@ def main():
|
|
|
|
p = module.params
|
|
|
|
p = module.params
|
|
|
|
|
|
|
|
|
|
|
|
force_yes = p['force']
|
|
|
|
force_yes = p['force']
|
|
|
|
no_suggest_yes = p['no_suggests']
|
|
|
|
no_recommends_yes = p['no_recommends']
|
|
|
|
|
|
|
|
|
|
|
|
if p['update_cache']:
|
|
|
|
if p['update_cache']:
|
|
|
|
update_package_db(module)
|
|
|
|
update_package_db(module)
|
|
|
@ -190,7 +190,7 @@ def main():
|
|
|
|
packages = p['package'].split(',')
|
|
|
|
packages = p['package'].split(',')
|
|
|
|
|
|
|
|
|
|
|
|
if p['state'] in [ 'installed', 'present' ]:
|
|
|
|
if p['state'] in [ 'installed', 'present' ]:
|
|
|
|
install_packages(module, packages, force_yes, no_suggest_yes)
|
|
|
|
install_packages(module, packages, force_yes, no_recommends_yes)
|
|
|
|
|
|
|
|
|
|
|
|
elif p['state'] in [ 'removed', 'absent' ]:
|
|
|
|
elif p['state'] in [ 'removed', 'absent' ]:
|
|
|
|
remove_packages(module, packages)
|
|
|
|
remove_packages(module, packages)
|
|
|
|