def do_ansible(args):
    master_dir = c.find_master_dir(os.getcwd())
    c.set_master_dir(master_dir)

    _, _, combined = c.load_user_config()

    if not 'HOSTS' in combined:
        retval = {}
    elif args.host:
        retval = combined['HOSTS'].get(args.host, {})
    elif args.list:
        retval = combined['HOSTS'] if combined else {}
    else:
        return False

    text = json.dumps(retval, indent=4)+'\n'
    print(text)  # newline
    return text
dataset/ETHPy150Open rr326/servi/servi/commands/inventory.py/do_ansible/original