|
|
@ -30,9 +30,9 @@ options:
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Indicates the desired package state. C(latest) ensures that the latest version is installed. C(build-dep) ensures the package build dependencies
|
|
|
|
- Indicates the desired package state. C(latest) ensures that the latest version is installed. C(build-dep) ensures the package build dependencies
|
|
|
|
are installed.
|
|
|
|
are installed. C(fixed) attempt to correct a system with broken dependencies in place.
|
|
|
|
default: present
|
|
|
|
default: present
|
|
|
|
choices: [ absent, build-dep, latest, present ]
|
|
|
|
choices: [ absent, build-dep, latest, present, fixed ]
|
|
|
|
update_cache:
|
|
|
|
update_cache:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Run the equivalent of C(apt-get update) before the operation. Can be run as part of the package installation or as a separate step.
|
|
|
|
- Run the equivalent of C(apt-get update) before the operation. Can be run as part of the package installation or as a separate step.
|
|
|
@ -514,7 +514,7 @@ def mark_installed_manually(m, packages):
|
|
|
|
def install(m, pkgspec, cache, upgrade=False, default_release=None,
|
|
|
|
def install(m, pkgspec, cache, upgrade=False, default_release=None,
|
|
|
|
install_recommends=None, force=False,
|
|
|
|
install_recommends=None, force=False,
|
|
|
|
dpkg_options=expand_dpkg_options(DPKG_OPTIONS),
|
|
|
|
dpkg_options=expand_dpkg_options(DPKG_OPTIONS),
|
|
|
|
build_dep=False, autoremove=False, only_upgrade=False,
|
|
|
|
build_dep=False, fixed=False, autoremove=False, only_upgrade=False,
|
|
|
|
allow_unauthenticated=False):
|
|
|
|
allow_unauthenticated=False):
|
|
|
|
pkg_list = []
|
|
|
|
pkg_list = []
|
|
|
|
packages = ""
|
|
|
|
packages = ""
|
|
|
@ -562,10 +562,15 @@ def install(m, pkgspec, cache, upgrade=False, default_release=None,
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
only_upgrade = ''
|
|
|
|
only_upgrade = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if fixed:
|
|
|
|
|
|
|
|
fixed = '--fix-broken'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
fixed = ''
|
|
|
|
|
|
|
|
|
|
|
|
if build_dep:
|
|
|
|
if build_dep:
|
|
|
|
cmd = "%s -y %s %s %s %s build-dep %s" % (APT_GET_CMD, dpkg_options, only_upgrade, force_yes, check_arg, packages)
|
|
|
|
cmd = "%s -y %s %s %s %s %s build-dep %s" % (APT_GET_CMD, dpkg_options, only_upgrade, fixed, force_yes, check_arg, packages)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
cmd = "%s -y %s %s %s %s %s install %s" % (APT_GET_CMD, dpkg_options, only_upgrade, force_yes, autoremove, check_arg, packages)
|
|
|
|
cmd = "%s -y %s %s %s %s %s %s install %s" % (APT_GET_CMD, dpkg_options, only_upgrade, fixed, force_yes, autoremove, check_arg, packages)
|
|
|
|
|
|
|
|
|
|
|
|
if default_release:
|
|
|
|
if default_release:
|
|
|
|
cmd += " -t '%s'" % (default_release,)
|
|
|
|
cmd += " -t '%s'" % (default_release,)
|
|
|
@ -898,7 +903,7 @@ def get_cache(module):
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
|
argument_spec=dict(
|
|
|
|
argument_spec=dict(
|
|
|
|
state=dict(type='str', default='present', choices=['absent', 'build-dep', 'installed', 'latest', 'present', 'removed', 'present']),
|
|
|
|
state=dict(type='str', default='present', choices=['absent', 'build-dep', 'installed', 'latest', 'present', 'removed', 'present', 'fixed']),
|
|
|
|
update_cache=dict(type='bool', aliases=['update-cache']),
|
|
|
|
update_cache=dict(type='bool', aliases=['update-cache']),
|
|
|
|
cache_valid_time=dict(type='int', default=0),
|
|
|
|
cache_valid_time=dict(type='int', default=0),
|
|
|
|
purge=dict(type='bool', default=False),
|
|
|
|
purge=dict(type='bool', default=False),
|
|
|
@ -1052,13 +1057,16 @@ def main():
|
|
|
|
if autoremove:
|
|
|
|
if autoremove:
|
|
|
|
cleanup(module, p['purge'], force=force_yes, operation='autoremove', dpkg_options=dpkg_options)
|
|
|
|
cleanup(module, p['purge'], force=force_yes, operation='autoremove', dpkg_options=dpkg_options)
|
|
|
|
|
|
|
|
|
|
|
|
if p['state'] in ('latest', 'present', 'build-dep'):
|
|
|
|
if p['state'] in ('latest', 'present', 'build-dep', 'fixed'):
|
|
|
|
state_upgrade = False
|
|
|
|
state_upgrade = False
|
|
|
|
state_builddep = False
|
|
|
|
state_builddep = False
|
|
|
|
|
|
|
|
state_fixed = False
|
|
|
|
if p['state'] == 'latest':
|
|
|
|
if p['state'] == 'latest':
|
|
|
|
state_upgrade = True
|
|
|
|
state_upgrade = True
|
|
|
|
if p['state'] == 'build-dep':
|
|
|
|
if p['state'] == 'build-dep':
|
|
|
|
state_builddep = True
|
|
|
|
state_builddep = True
|
|
|
|
|
|
|
|
if p['state'] == 'fixed':
|
|
|
|
|
|
|
|
state_fixed = True
|
|
|
|
|
|
|
|
|
|
|
|
success, retvals = install(
|
|
|
|
success, retvals = install(
|
|
|
|
module,
|
|
|
|
module,
|
|
|
@ -1070,6 +1078,7 @@ def main():
|
|
|
|
force=force_yes,
|
|
|
|
force=force_yes,
|
|
|
|
dpkg_options=dpkg_options,
|
|
|
|
dpkg_options=dpkg_options,
|
|
|
|
build_dep=state_builddep,
|
|
|
|
build_dep=state_builddep,
|
|
|
|
|
|
|
|
fixed=state_fixed,
|
|
|
|
autoremove=autoremove,
|
|
|
|
autoremove=autoremove,
|
|
|
|
only_upgrade=p['only_upgrade'],
|
|
|
|
only_upgrade=p['only_upgrade'],
|
|
|
|
allow_unauthenticated=allow_unauthenticated
|
|
|
|
allow_unauthenticated=allow_unauthenticated
|
|
|
|