'Return a tuple containing the host list the given task should be using
and the roles being used.
See :ref:`host-lists` for detailed documentation on how host lists are
set.
.. versionchanged:: 1.9'

def get_hosts_and_effective_roles(self, arg_hosts, arg_roles, arg_exclude_hosts, env=None):

    env = (env or {'hosts': [], 'roles': [], 'exclude_hosts': []})
    roledefs = env.get('roledefs', {})
    if (arg_hosts or arg_roles):
        return (merge(arg_hosts, arg_roles, arg_exclude_hosts, roledefs), arg_roles)
    func_hosts = getattr(self, 'hosts', [])
    func_roles = getattr(self, 'roles', [])
    if (func_hosts or func_roles):
        return (merge(func_hosts, func_roles, arg_exclude_hosts, roledefs), func_roles)
    env_vars = map(_get_list(env), 'hosts    roles    exclude_hosts'.split())
    env_vars.append(roledefs)
    return (merge(*env_vars), env.get('roles', []))
