def METHOD_NAME(module, packages, root):
    remove_c = 0
    # Using a for loop in case of error, we can report the package that failed
    for package in packages:
        # Query the package first, to see if we even need to remove
        if not query_package(module, package, root):
            continue
        urpme_path = module.get_bin_path("urpme", True)
        cmd = "%s --auto %s %s" % (urpme_path, root_option(root), package)
        rc, stdout, stderr = module.run_command(cmd, check_rc=False)
        if rc != 0:
            module.fail_json(msg="failed to remove %s" % (package))
        remove_c += 1
    if remove_c > 0:
        module.exit_json(changed=True, msg="removed %s package(s)" % remove_c)
    module.exit_json(changed=False, msg="package(s) already absent")