Apt module should accept 'absent', and 'present' like the yum module does.

pull/908/head
Michael DeHaan 12 years ago
parent 7fd4051857
commit 798c35d83e

@ -119,7 +119,7 @@ def remove(m, pkgspec, cache, purge=False):
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec = dict( argument_spec = dict(
state = dict(default='installed', choices=['installed', 'latest', 'removed']), state = dict(default='installed', choices=['installed', 'latest', 'removed', 'absent', 'present']),
update_cache = dict(default='no', choices=['yes', 'no'], aliases=['update-cache']), update_cache = dict(default='no', choices=['yes', 'no'], aliases=['update-cache']),
purge = dict(default='no', choices=['yes', 'no']), purge = dict(default='no', choices=['yes', 'no']),
package = dict(default=None, aliases=['pkg', 'name']), package = dict(default=None, aliases=['pkg', 'name']),
@ -171,10 +171,10 @@ def main():
default_release=p['default_release'], default_release=p['default_release'],
install_recommends=install_recommends, install_recommends=install_recommends,
force=force_yes) force=force_yes)
elif p['state'] == 'installed': elif p['state'] in [ 'installed', 'present' ]:
install(module, packages, cache, default_release=p['default_release'], install(module, packages, cache, default_release=p['default_release'],
install_recommends=install_recommends,force=force_yes) install_recommends=install_recommends,force=force_yes)
elif p['state'] == 'removed': elif p['state'] in [ 'removed', 'absent' ]:
remove(module, packages, cache, purge = module.boolean(p['purge'])) remove(module, packages, cache, purge = module.boolean(p['purge']))
# this is magic, see lib/ansible/module_common.py # this is magic, see lib/ansible/module_common.py

Loading…
Cancel
Save