Beispiel #1
0
def main():
    result = {}
    module = AnsibleModule(
        argument_spec=dict(
            category=dict(required=True),
            command=dict(required=True, type='list'),
            baseuri=dict(required=True),
            username=dict(required=True),
            password=dict(required=True, no_log=True),
            bios_attribute_name=dict(default='null'),
            bios_attribute_value=dict(default='null', type='raw'),
            bios_attributes=dict(type='dict', default={}),
            timeout=dict(type='int', default=10),
            boot_order=dict(type='list', elements='str', default=[]),
            network_protocols=dict(
                type='dict',
                default={}
            ),
            resource_id=dict(),
            nic_addr=dict(default='null'),
            nic_config=dict(
                type='dict',
                default={}
            )
        ),
        supports_check_mode=False
    )

    category = module.params['category']
    command_list = module.params['command']

    # admin credentials used for authentication
    creds = {'user': module.params['username'],
             'pswd': module.params['password']}

    # timeout
    timeout = module.params['timeout']

    # BIOS attributes to update
    bios_attributes = module.params['bios_attributes']
    if module.params['bios_attribute_name'] != 'null':
        bios_attributes[module.params['bios_attribute_name']] = module.params[
            'bios_attribute_value']
        module.deprecate(msg='The bios_attribute_name/bios_attribute_value '
                         'options are deprecated. Use bios_attributes instead',
                         version='3.0.0', collection_name='community.general')  # was Ansible 2.14

    # boot order
    boot_order = module.params['boot_order']

    # System, Manager or Chassis ID to modify
    resource_id = module.params['resource_id']

    # manager nic
    nic_addr = module.params['nic_addr']
    nic_config = module.params['nic_config']

    # Build root URI
    root_uri = "https://" + module.params['baseuri']
    rf_utils = RedfishUtils(creds, root_uri, timeout, module,
                            resource_id=resource_id, data_modification=True)

    # Check that Category is valid
    if category not in CATEGORY_COMMANDS_ALL:
        module.fail_json(msg=to_native("Invalid Category '%s'. Valid Categories = %s" % (category, CATEGORY_COMMANDS_ALL.keys())))

    # Check that all commands are valid
    for cmd in command_list:
        # Fail if even one command given is invalid
        if cmd not in CATEGORY_COMMANDS_ALL[category]:
            module.fail_json(msg=to_native("Invalid Command '%s'. Valid Commands = %s" % (cmd, CATEGORY_COMMANDS_ALL[category])))

    # Organize by Categories / Commands
    if category == "Systems":
        # execute only if we find a System resource
        result = rf_utils._find_systems_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            if command == "SetBiosDefaultSettings":
                result = rf_utils.set_bios_default_settings()
            elif command == "SetBiosAttributes":
                result = rf_utils.set_bios_attributes(bios_attributes)
            elif command == "SetBootOrder":
                result = rf_utils.set_boot_order(boot_order)
            elif command == "SetDefaultBootOrder":
                result = rf_utils.set_default_boot_order()

    elif category == "Manager":
        # execute only if we find a Manager service resource
        result = rf_utils._find_managers_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            if command == "SetNetworkProtocols":
                result = rf_utils.set_network_protocols(module.params['network_protocols'])
            elif command == "SetManagerNic":
                result = rf_utils.set_manager_nic(nic_addr, nic_config)

    # Return data back or fail with proper message
    if result['ret'] is True:
        module.exit_json(changed=result['changed'], msg=to_native(result['msg']))
    else:
        module.fail_json(msg=to_native(result['msg']))
Beispiel #2
0
def main():
    result = {}
    module = AnsibleModule(argument_spec=dict(
        category=dict(required=True),
        command=dict(required=True, type='list', elements='str'),
        baseuri=dict(required=True),
        username=dict(),
        password=dict(no_log=True),
        auth_token=dict(no_log=True),
        session_uri=dict(),
        id=dict(aliases=["account_id"]),
        new_username=dict(aliases=["account_username"]),
        new_password=dict(aliases=["account_password"], no_log=True),
        roleid=dict(aliases=["account_roleid"]),
        update_username=dict(type='str', aliases=["account_updatename"]),
        account_properties=dict(type='dict', default={}),
        bootdevice=dict(),
        timeout=dict(type='int', default=10),
        uefi_target=dict(),
        boot_next=dict(),
        boot_override_mode=dict(choices=['Legacy', 'UEFI']),
        resource_id=dict(),
        update_image_uri=dict(),
        update_protocol=dict(),
        update_targets=dict(type='list', elements='str', default=[]),
        update_creds=dict(type='dict',
                          options=dict(username=dict(),
                                       password=dict(no_log=True))),
        virtual_media=dict(type='dict',
                           options=dict(
                               media_types=dict(type='list',
                                                elements='str',
                                                default=[]),
                               image_url=dict(),
                               inserted=dict(type='bool', default=True),
                               write_protected=dict(type='bool', default=True),
                               username=dict(),
                               password=dict(no_log=True),
                               transfer_protocol_type=dict(),
                               transfer_method=dict(),
                           )),
        strip_etag_quotes=dict(type='bool', default=False),
    ),
                           required_together=[
                               ('username', 'password'),
                           ],
                           required_one_of=[
                               ('username', 'auth_token'),
                           ],
                           mutually_exclusive=[
                               ('username', 'auth_token'),
                           ],
                           supports_check_mode=False)

    category = module.params['category']
    command_list = module.params['command']

    # admin credentials used for authentication
    creds = {
        'user': module.params['username'],
        'pswd': module.params['password'],
        'token': module.params['auth_token']
    }

    # user to add/modify/delete
    user = {
        'account_id': module.params['id'],
        'account_username': module.params['new_username'],
        'account_password': module.params['new_password'],
        'account_roleid': module.params['roleid'],
        'account_updatename': module.params['update_username'],
        'account_properties': module.params['account_properties']
    }

    # timeout
    timeout = module.params['timeout']

    # System, Manager or Chassis ID to modify
    resource_id = module.params['resource_id']

    # update options
    update_opts = {
        'update_image_uri': module.params['update_image_uri'],
        'update_protocol': module.params['update_protocol'],
        'update_targets': module.params['update_targets'],
        'update_creds': module.params['update_creds']
    }

    # Boot override options
    boot_opts = {
        'bootdevice': module.params['bootdevice'],
        'uefi_target': module.params['uefi_target'],
        'boot_next': module.params['boot_next'],
        'boot_override_mode': module.params['boot_override_mode'],
    }

    # VirtualMedia options
    virtual_media = module.params['virtual_media']

    # Etag options
    strip_etag_quotes = module.params['strip_etag_quotes']

    # Build root URI
    root_uri = "https://" + module.params['baseuri']
    rf_utils = RedfishUtils(creds,
                            root_uri,
                            timeout,
                            module,
                            resource_id=resource_id,
                            data_modification=True,
                            strip_etag_quotes=strip_etag_quotes)

    # Check that Category is valid
    if category not in CATEGORY_COMMANDS_ALL:
        module.fail_json(
            msg=to_native("Invalid Category '%s'. Valid Categories = %s" %
                          (category, list(CATEGORY_COMMANDS_ALL.keys()))))

    # Check that all commands are valid
    for cmd in command_list:
        # Fail if even one command given is invalid
        if cmd not in CATEGORY_COMMANDS_ALL[category]:
            module.fail_json(
                msg=to_native("Invalid Command '%s'. Valid Commands = %s" %
                              (cmd, CATEGORY_COMMANDS_ALL[category])))

    # Organize by Categories / Commands
    if category == "Accounts":
        ACCOUNTS_COMMANDS = {
            "AddUser":
            rf_utils.add_user,
            "EnableUser":
            rf_utils.enable_user,
            "DeleteUser":
            rf_utils.delete_user,
            "DisableUser":
            rf_utils.disable_user,
            "UpdateUserRole":
            rf_utils.update_user_role,
            "UpdateUserPassword":
            rf_utils.update_user_password,
            "UpdateUserName":
            rf_utils.update_user_name,
            "UpdateAccountServiceProperties":
            rf_utils.update_accountservice_properties
        }

        # execute only if we find an Account service resource
        result = rf_utils._find_accountservice_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            result = ACCOUNTS_COMMANDS[command](user)

    elif category == "Systems":
        # execute only if we find a System resource
        result = rf_utils._find_systems_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            if command.startswith('Power'):
                result = rf_utils.manage_system_power(command)
            elif command == "SetOneTimeBoot":
                boot_opts['override_enabled'] = 'Once'
                result = rf_utils.set_boot_override(boot_opts)
            elif command == "EnableContinuousBootOverride":
                boot_opts['override_enabled'] = 'Continuous'
                result = rf_utils.set_boot_override(boot_opts)
            elif command == "DisableBootOverride":
                boot_opts['override_enabled'] = 'Disabled'
                result = rf_utils.set_boot_override(boot_opts)

    elif category == "Chassis":
        result = rf_utils._find_chassis_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        led_commands = [
            "IndicatorLedOn", "IndicatorLedOff", "IndicatorLedBlink"
        ]

        # Check if more than one led_command is present
        num_led_commands = sum(
            [command in led_commands for command in command_list])
        if num_led_commands > 1:
            result = {
                'ret': False,
                'msg':
                "Only one IndicatorLed command should be sent at a time."
            }
        else:
            for command in command_list:
                if command in led_commands:
                    result = rf_utils.manage_indicator_led(command)

    elif category == "Sessions":
        # execute only if we find SessionService resources
        resource = rf_utils._find_sessionservice_resource()
        if resource['ret'] is False:
            module.fail_json(msg=resource['msg'])

        for command in command_list:
            if command == "ClearSessions":
                result = rf_utils.clear_sessions()
            elif command == "CreateSession":
                result = rf_utils.create_session()
            elif command == "DeleteSession":
                result = rf_utils.delete_session(module.params['session_uri'])

    elif category == "Manager":
        # execute only if we find a Manager service resource
        result = rf_utils._find_managers_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            # standardize on the Power* commands, but allow the the legacy
            # GracefulRestart command
            if command == 'GracefulRestart':
                command = 'PowerGracefulRestart'

            if command.startswith('Power'):
                result = rf_utils.manage_manager_power(command)
            elif command == 'ClearLogs':
                result = rf_utils.clear_logs()
            elif command == 'VirtualMediaInsert':
                result = rf_utils.virtual_media_insert(virtual_media)
            elif command == 'VirtualMediaEject':
                result = rf_utils.virtual_media_eject(virtual_media)

    elif category == "Update":
        # execute only if we find UpdateService resources
        resource = rf_utils._find_updateservice_resource()
        if resource['ret'] is False:
            module.fail_json(msg=resource['msg'])

        for command in command_list:
            if command == "SimpleUpdate":
                result = rf_utils.simple_update(update_opts)

    # Return data back or fail with proper message
    if result['ret'] is True:
        del result['ret']
        changed = result.get('changed', True)
        session = result.get('session', dict())
        module.exit_json(changed=changed,
                         session=session,
                         msg='Action was successful')
    else:
        module.fail_json(msg=to_native(result['msg']))
def main():
    result = {}
    module = AnsibleModule(argument_spec=dict(
        category=dict(required=True),
        command=dict(required=True, type='list'),
        baseuri=dict(required=True),
        username=dict(required=True),
        password=dict(required=True, no_log=True),
        id=dict(aliases=["account_id"]),
        new_username=dict(aliases=["account_username"]),
        new_password=dict(aliases=["account_password"], no_log=True),
        roleid=dict(aliases=["account_roleid"]),
        update_username=dict(type='str', aliases=["account_updatename"]),
        account_properties=dict(type='dict', default={}),
        bootdevice=dict(),
        timeout=dict(type='int', default=10),
        uefi_target=dict(),
        boot_next=dict(),
        resource_id=dict(),
        update_image_uri=dict(),
        update_protocol=dict(),
        update_targets=dict(type='list', elements='str', default=[]),
        update_creds=dict(type='dict',
                          options=dict(username=dict(), password=dict()))),
                           supports_check_mode=False)

    category = module.params['category']
    command_list = module.params['command']

    # admin credentials used for authentication
    creds = {
        'user': module.params['username'],
        'pswd': module.params['password']
    }

    # user to add/modify/delete
    user = {
        'account_id': module.params['id'],
        'account_username': module.params['new_username'],
        'account_password': module.params['new_password'],
        'account_roleid': module.params['roleid'],
        'account_updatename': module.params['update_username'],
        'account_properties': module.params['account_properties']
    }

    # timeout
    timeout = module.params['timeout']

    # System, Manager or Chassis ID to modify
    resource_id = module.params['resource_id']

    # update options
    update_opts = {
        'update_image_uri': module.params['update_image_uri'],
        'update_protocol': module.params['update_protocol'],
        'update_targets': module.params['update_targets'],
        'update_creds': module.params['update_creds']
    }

    # Build root URI
    root_uri = "https://" + module.params['baseuri']
    rf_utils = RedfishUtils(creds,
                            root_uri,
                            timeout,
                            module,
                            resource_id=resource_id,
                            data_modification=True)

    # Check that Category is valid
    if category not in CATEGORY_COMMANDS_ALL:
        module.fail_json(
            msg=to_native("Invalid Category '%s'. Valid Categories = %s" %
                          (category, CATEGORY_COMMANDS_ALL.keys())))

    # Check that all commands are valid
    for cmd in command_list:
        # Fail if even one command given is invalid
        if cmd not in CATEGORY_COMMANDS_ALL[category]:
            module.fail_json(
                msg=to_native("Invalid Command '%s'. Valid Commands = %s" %
                              (cmd, CATEGORY_COMMANDS_ALL[category])))

    # Organize by Categories / Commands
    if category == "Accounts":
        ACCOUNTS_COMMANDS = {
            "AddUser":
            rf_utils.add_user,
            "EnableUser":
            rf_utils.enable_user,
            "DeleteUser":
            rf_utils.delete_user,
            "DisableUser":
            rf_utils.disable_user,
            "UpdateUserRole":
            rf_utils.update_user_role,
            "UpdateUserPassword":
            rf_utils.update_user_password,
            "UpdateUserName":
            rf_utils.update_user_name,
            "UpdateAccountServiceProperties":
            rf_utils.update_accountservice_properties
        }

        # execute only if we find an Account service resource
        result = rf_utils._find_accountservice_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            result = ACCOUNTS_COMMANDS[command](user)

    elif category == "Systems":
        # execute only if we find a System resource
        result = rf_utils._find_systems_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            if "Power" in command:
                result = rf_utils.manage_system_power(command)
            elif command == "SetOneTimeBoot":
                result = rf_utils.set_one_time_boot_device(
                    module.params['bootdevice'], module.params['uefi_target'],
                    module.params['boot_next'])

    elif category == "Chassis":
        result = rf_utils._find_chassis_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        led_commands = [
            "IndicatorLedOn", "IndicatorLedOff", "IndicatorLedBlink"
        ]

        # Check if more than one led_command is present
        num_led_commands = sum(
            [command in led_commands for command in command_list])
        if num_led_commands > 1:
            result = {
                'ret': False,
                'msg':
                "Only one IndicatorLed command should be sent at a time."
            }
        else:
            for command in command_list:
                if command in led_commands:
                    result = rf_utils.manage_indicator_led(command)

    elif category == "Sessions":
        # execute only if we find SessionService resources
        resource = rf_utils._find_sessionservice_resource()
        if resource['ret'] is False:
            module.fail_json(msg=resource['msg'])

        for command in command_list:
            if command == "ClearSessions":
                result = rf_utils.clear_sessions()

    elif category == "Manager":
        MANAGER_COMMANDS = {
            "GracefulRestart": rf_utils.restart_manager_gracefully,
            "ClearLogs": rf_utils.clear_logs
        }

        # execute only if we find a Manager service resource
        result = rf_utils._find_managers_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            result = MANAGER_COMMANDS[command]()

    elif category == "Update":
        # execute only if we find UpdateService resources
        resource = rf_utils._find_updateservice_resource()
        if resource['ret'] is False:
            module.fail_json(msg=resource['msg'])

        for command in command_list:
            if command == "SimpleUpdate":
                result = rf_utils.simple_update(update_opts)

    # Return data back or fail with proper message
    if result['ret'] is True:
        del result['ret']
        changed = result.get('changed', True)
        module.exit_json(changed=changed, msg='Action was successful')
    else:
        module.fail_json(msg=to_native(result['msg']))
Beispiel #4
0
def main():
    result = {}
    category_list = []
    module = AnsibleModule(argument_spec=dict(category=dict(
        type='list', default=['Systems']),
                                              command=dict(type='list'),
                                              baseuri=dict(required=True),
                                              username=dict(required=True),
                                              password=dict(required=True,
                                                            no_log=True),
                                              timeout=dict(type='int',
                                                           default=10)),
                           supports_check_mode=False)
    is_old_facts = module._name in ('redfish_facts',
                                    'community.general.redfish_facts')
    if is_old_facts:
        module.deprecate(
            "The 'redfish_facts' module has been renamed to 'redfish_info', "
            "and the renamed one no longer returns ansible_facts",
            version='3.0.0',
            collection_name='community.general')  # was Ansible 2.13

    # admin credentials used for authentication
    creds = {
        'user': module.params['username'],
        'pswd': module.params['password']
    }

    # timeout
    timeout = module.params['timeout']

    # Build root URI
    root_uri = "https://" + module.params['baseuri']
    rf_utils = RedfishUtils(creds, root_uri, timeout, module)

    # Build Category list
    if "all" in module.params['category']:
        for entry in CATEGORY_COMMANDS_ALL:
            category_list.append(entry)
    else:
        # one or more categories specified
        category_list = module.params['category']

    for category in category_list:
        command_list = []
        # Build Command list for each Category
        if category in CATEGORY_COMMANDS_ALL:
            if not module.params['command']:
                # True if we don't specify a command --> use default
                command_list.append(CATEGORY_COMMANDS_DEFAULT[category])
            elif "all" in module.params['command']:
                for entry in range(len(CATEGORY_COMMANDS_ALL[category])):
                    command_list.append(CATEGORY_COMMANDS_ALL[category][entry])
            # one or more commands
            else:
                command_list = module.params['command']
                # Verify that all commands are valid
                for cmd in command_list:
                    # Fail if even one command given is invalid
                    if cmd not in CATEGORY_COMMANDS_ALL[category]:
                        module.fail_json(msg="Invalid Command: %s" % cmd)
        else:
            # Fail if even one category given is invalid
            module.fail_json(msg="Invalid Category: %s" % category)

        # Organize by Categories / Commands
        if category == "Systems":
            # execute only if we find a Systems resource
            resource = rf_utils._find_systems_resource()
            if resource['ret'] is False:
                module.fail_json(msg=resource['msg'])

            for command in command_list:
                if command == "GetSystemInventory":
                    result["system"] = rf_utils.get_multi_system_inventory()
                elif command == "GetCpuInventory":
                    result["cpu"] = rf_utils.get_multi_cpu_inventory()
                elif command == "GetMemoryInventory":
                    result["memory"] = rf_utils.get_multi_memory_inventory()
                elif command == "GetNicInventory":
                    result["nic"] = rf_utils.get_multi_nic_inventory(category)
                elif command == "GetStorageControllerInventory":
                    result[
                        "storage_controller"] = rf_utils.get_multi_storage_controller_inventory(
                        )
                elif command == "GetDiskInventory":
                    result["disk"] = rf_utils.get_multi_disk_inventory()
                elif command == "GetVolumeInventory":
                    result["volume"] = rf_utils.get_multi_volume_inventory()
                elif command == "GetBiosAttributes":
                    result[
                        "bios_attribute"] = rf_utils.get_multi_bios_attributes(
                        )
                elif command == "GetBootOrder":
                    result["boot_order"] = rf_utils.get_multi_boot_order()
                elif command == "GetBootOverride":
                    result["boot_override"] = rf_utils.get_multi_boot_override(
                    )
                elif command == "GetHealthReport":
                    result[
                        "health_report"] = rf_utils.get_multi_system_health_report(
                        )

        elif category == "Chassis":
            # execute only if we find Chassis resource
            resource = rf_utils._find_chassis_resource()
            if resource['ret'] is False:
                module.fail_json(msg=resource['msg'])

            for command in command_list:
                if command == "GetFanInventory":
                    result["fan"] = rf_utils.get_fan_inventory()
                elif command == "GetPsuInventory":
                    result["psu"] = rf_utils.get_psu_inventory()
                elif command == "GetChassisThermals":
                    result["thermals"] = rf_utils.get_chassis_thermals()
                elif command == "GetChassisPower":
                    result["chassis_power"] = rf_utils.get_chassis_power()
                elif command == "GetChassisInventory":
                    result["chassis"] = rf_utils.get_chassis_inventory()
                elif command == "GetHealthReport":
                    result[
                        "health_report"] = rf_utils.get_multi_chassis_health_report(
                        )

        elif category == "Accounts":
            # execute only if we find an Account service resource
            resource = rf_utils._find_accountservice_resource()
            if resource['ret'] is False:
                module.fail_json(msg=resource['msg'])

            for command in command_list:
                if command == "ListUsers":
                    result["user"] = rf_utils.list_users()

        elif category == "Update":
            # execute only if we find UpdateService resources
            resource = rf_utils._find_updateservice_resource()
            if resource['ret'] is False:
                module.fail_json(msg=resource['msg'])

            for command in command_list:
                if command == "GetFirmwareInventory":
                    result["firmware"] = rf_utils.get_firmware_inventory()
                elif command == "GetSoftwareInventory":
                    result["software"] = rf_utils.get_software_inventory()
                elif command == "GetFirmwareUpdateCapabilities":
                    result[
                        "firmware_update_capabilities"] = rf_utils.get_firmware_update_capabilities(
                        )

        elif category == "Sessions":
            # execute only if we find SessionService resources
            resource = rf_utils._find_sessionservice_resource()
            if resource['ret'] is False:
                module.fail_json(msg=resource['msg'])

            for command in command_list:
                if command == "GetSessions":
                    result["session"] = rf_utils.get_sessions()

        elif category == "Manager":
            # execute only if we find a Manager service resource
            resource = rf_utils._find_managers_resource()
            if resource['ret'] is False:
                module.fail_json(msg=resource['msg'])

            for command in command_list:
                if command == "GetManagerNicInventory":
                    result["manager_nics"] = rf_utils.get_multi_nic_inventory(
                        category)
                elif command == "GetVirtualMedia":
                    result["virtual_media"] = rf_utils.get_multi_virtualmedia()
                elif command == "GetLogs":
                    result["log"] = rf_utils.get_logs()
                elif command == "GetNetworkProtocols":
                    result[
                        "network_protocols"] = rf_utils.get_network_protocols(
                        )
                elif command == "GetHealthReport":
                    result[
                        "health_report"] = rf_utils.get_multi_manager_health_report(
                        )

    # Return data back
    if is_old_facts:
        module.exit_json(ansible_facts=dict(redfish_facts=result))
    else:
        module.exit_json(redfish_facts=result)
def main():
    result = {}
    module = AnsibleModule(argument_spec=dict(
        category=dict(required=True),
        command=dict(required=True, type='list', elements='str'),
        baseuri=dict(required=True),
        username=dict(),
        password=dict(no_log=True),
        auth_token=dict(no_log=True),
        bios_attributes=dict(type='dict', default={}),
        timeout=dict(type='int', default=10),
        boot_order=dict(type='list', elements='str', default=[]),
        network_protocols=dict(type='dict', default={}),
        resource_id=dict(),
        nic_addr=dict(default='null'),
        nic_config=dict(type='dict', default={}),
        strip_etag_quotes=dict(type='bool', default=False),
    ),
                           required_together=[
                               ('username', 'password'),
                           ],
                           required_one_of=[
                               ('username', 'auth_token'),
                           ],
                           mutually_exclusive=[
                               ('username', 'auth_token'),
                           ],
                           supports_check_mode=False)

    category = module.params['category']
    command_list = module.params['command']

    # admin credentials used for authentication
    creds = {
        'user': module.params['username'],
        'pswd': module.params['password'],
        'token': module.params['auth_token']
    }

    # timeout
    timeout = module.params['timeout']

    # BIOS attributes to update
    bios_attributes = module.params['bios_attributes']

    # boot order
    boot_order = module.params['boot_order']

    # System, Manager or Chassis ID to modify
    resource_id = module.params['resource_id']

    # manager nic
    nic_addr = module.params['nic_addr']
    nic_config = module.params['nic_config']

    # Etag options
    strip_etag_quotes = module.params['strip_etag_quotes']

    # Build root URI
    root_uri = "https://" + module.params['baseuri']
    rf_utils = RedfishUtils(creds,
                            root_uri,
                            timeout,
                            module,
                            resource_id=resource_id,
                            data_modification=True,
                            strip_etag_quotes=strip_etag_quotes)

    # Check that Category is valid
    if category not in CATEGORY_COMMANDS_ALL:
        module.fail_json(
            msg=to_native("Invalid Category '%s'. Valid Categories = %s" %
                          (category, list(CATEGORY_COMMANDS_ALL.keys()))))

    # Check that all commands are valid
    for cmd in command_list:
        # Fail if even one command given is invalid
        if cmd not in CATEGORY_COMMANDS_ALL[category]:
            module.fail_json(
                msg=to_native("Invalid Command '%s'. Valid Commands = %s" %
                              (cmd, CATEGORY_COMMANDS_ALL[category])))

    # Organize by Categories / Commands
    if category == "Systems":
        # execute only if we find a System resource
        result = rf_utils._find_systems_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            if command == "SetBiosDefaultSettings":
                result = rf_utils.set_bios_default_settings()
            elif command == "SetBiosAttributes":
                result = rf_utils.set_bios_attributes(bios_attributes)
            elif command == "SetBootOrder":
                result = rf_utils.set_boot_order(boot_order)
            elif command == "SetDefaultBootOrder":
                result = rf_utils.set_default_boot_order()

    elif category == "Manager":
        # execute only if we find a Manager service resource
        result = rf_utils._find_managers_resource()
        if result['ret'] is False:
            module.fail_json(msg=to_native(result['msg']))

        for command in command_list:
            if command == "SetNetworkProtocols":
                result = rf_utils.set_network_protocols(
                    module.params['network_protocols'])
            elif command == "SetManagerNic":
                result = rf_utils.set_manager_nic(nic_addr, nic_config)

    # Return data back or fail with proper message
    if result['ret'] is True:
        if result.get('warning'):
            module.warn(to_native(result['warning']))

        module.exit_json(changed=result['changed'],
                         msg=to_native(result['msg']))
    else:
        module.fail_json(msg=to_native(result['msg']))