Exemple #1
0
    try:
        orig_group_list = [gl['group_name'] for gl in iam.get_all_groups().
                list_groups_result.
                groups]

        orig_user_list = [ul['user_name'] for ul in iam.get_all_users().
                list_users_result.
                users]

        orig_role_list = [rl['role_name'] for rl in iam.list_roles().list_roles_response.
                list_roles_result.
                roles]

        orig_prof_list = [ap['instance_profile_name'] for ap in iam.list_instance_profiles().
                list_instance_profiles_response.
                list_instance_profiles_result.
                instance_profiles]
    except boto.exception.BotoServerError, err:
        module.fail_json(msg=err.message)

    if iam_type == 'user':
        been_updated = False
        user_groups = None
        user_exists = any([n in [name, new_name] for n in orig_user_list])
        if user_exists:
            current_path = iam.get_user(name).get_user_result.user['path']
            if not new_path and current_path != path:
                new_path = path
                path = current_path

        if state == 'present' and not user_exists and not new_name:
Exemple #2
0
            for gl in iam.get_all_groups().list_groups_result.groups
        ]

        orig_user_list = [
            ul['user_name']
            for ul in iam.get_all_users().list_users_result.users
        ]

        orig_role_list = [
            rl['role_name'] for rl in
            iam.list_roles().list_roles_response.list_roles_result.roles
        ]

        orig_prof_list = [
            ap['instance_profile_name'] for ap in
            iam.list_instance_profiles().list_instance_profiles_response.
            list_instance_profiles_result.instance_profiles
        ]
    except boto.exception.BotoServerError, err:
        module.fail_json(msg=err.message)

    if iam_type == 'user':
        been_updated = False
        user_groups = None
        user_exists = any([n in [name, new_name] for n in orig_user_list])
        if user_exists:
            current_path = iam.get_user(name).get_user_result.user['path']
            if not new_path and current_path != path:
                new_path = path
                path = current_path

        if state == 'present' and not user_exists and not new_name:
def get_instance_profiles(iam):
    return [
        prof['instance_profile_name'] for prof in iam.list_instance_profiles().
        list_instance_profiles_response.instance_profiles
    ]
Exemple #4
0
    try:
        orig_group_list = [gl['group_name'] for gl in iam.get_all_groups().
                list_groups_result.
                groups]

        orig_user_list = [ul['user_name'] for ul in iam.get_all_users().
                list_users_result.
                users]

        orig_role_list = [rl['role_name'] for rl in iam.list_roles().list_roles_response.
                list_roles_result.
                roles]

        orig_prof_list = [ap['instance_profile_name'] for ap in iam.list_instance_profiles().
                list_instance_profiles_response.
                list_instance_profiles_result.
                instance_profiles]
    except boto.exception.BotoServerError, err:
        module.fail_json(msg=err.message)

    if iam_type == 'user':
        been_updated = False
        user_groups = None
        user_exists = any([n in [name, new_name] for n in orig_user_list])
        if user_exists:
            current_path = iam.get_user(name).get_user_result.user['path']
            if not new_path and current_path != path:
                new_path = path
                path = current_path

        if state == 'present' and not user_exists and not new_name: