@operation(pipeline_facts={
    'directory': 'name'
})
def directory(
    state, host, name,
    present=True, user=None, group=None, mode=None, recursive=False
):

    mode = ensure_mode_int(mode)
    info = host.fact.directory(name)
    commands = []

    # Not a directory?!
    if info is False:
        raise OperationError('{0} exists and is not a directory'.format(name))

    # Doesn't exist & we want it
    if info is None and present:
        commands.append('mkdir -p {0}'.format(name))
        if mode:
            commands.append(chmod(name, mode, recursive=recursive))
        if user or group:
            commands.append(chown(name, user, group, recursive=recursive))

    # It exists and we don't want it
    elif info and not present:
        commands.append('rm -rf {0}'.format(name))

    # It exists & we want to ensure its state
    elif info and present:
        # Check mode
        if mode and info['mode'] != mode:
            commands.append(chmod(name, mode, recursive=recursive))

        # Check user/group
        if (user and info['user'] != user) or (group and info['group'] != group):
            commands.append(chown(name, user, group, recursive=recursive))

    return commands
Changes the status of the specified access key from Active to Inactive
dataset/ETHPy150Open Fizzadar/pyinfra/pyinfra/modules/files.py/directory--crossover with--dataset/ETHPy150Open darcyliu/storyboard/boto/iam/connection.py/IAMConnection.update_access_key