diff --git a/changelogs/fragments/6208-hpe-thermal-fan-percent.yaml b/changelogs/fragments/6208-hpe-thermal-fan-percent.yaml new file mode 100644 index 0000000000..61ce97aa03 --- /dev/null +++ b/changelogs/fragments/6208-hpe-thermal-fan-percent.yaml @@ -0,0 +1,2 @@ +minor_changes: + - redfish_info - adds commands to retrieve the HPE ThermalConfiguration and FanPercentMinimum settings from iLO (https://github.com/ansible-collections/community.general/pull/6208). diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index 4803cf1ac8..9b64703027 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -3217,3 +3217,35 @@ class RedfishUtils(object): body["SecureBootEnable"] = True return self.patch_request(self.root_uri + secure_boot_url, body, check_pyld=True) + + def get_hpe_thermal_config(self): + result = {} + key = "Thermal" + # Go through list + for chassis_uri in self.chassis_uri_list: + response = self.get_request(self.root_uri + chassis_uri) + if response['ret'] is False: + return response + result['ret'] = True + data = response['data'] + oem = data.get['Oem'] + hpe = oem.get['Hpe'] + thermal_config = hpe.get('ThermalConfiguration') + result["current_thermal_config"] = thermal_config + return result + + def get_hpe_fan_percent_min(self): + result = {} + key = "Thermal" + # Go through list + for chassis_uri in self.chassis_uri_list: + response = self.get_request(self.root_uri + chassis_uri) + if response['ret'] is False: + return response + result['ret'] = True + data = response['data'] + oem = data.get['Oem'] + hpe = oem.get['Hpe'] + fan_percent_min_config = hpe.get('FanPercentMinimum') + result["fan_percent_min"] = fan_percent_min_config + return result diff --git a/plugins/modules/redfish_info.py b/plugins/modules/redfish_info.py index 32e8766481..364df40b5f 100644 --- a/plugins/modules/redfish_info.py +++ b/plugins/modules/redfish_info.py @@ -321,6 +321,22 @@ EXAMPLES = ''' baseuri: "{{ baseuri }}" username: "{{ username }}" password: "{{ password }}" + + - name: Get HPE Thermal Config + community.general.redfish_info: + category: Chassis + command: GetHPEThermalConfig + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + + - name: Get HPE Fan Percent Minimum + community.general.redfish_info: + category: Chassis + command: GetHPEFanPercentMin + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" ''' RETURN = ''' @@ -340,7 +356,7 @@ CATEGORY_COMMANDS_ALL = { "GetStorageControllerInventory", "GetDiskInventory", "GetVolumeInventory", "GetBiosAttributes", "GetBootOrder", "GetBootOverride", "GetVirtualMedia"], "Chassis": ["GetFanInventory", "GetPsuInventory", "GetChassisPower", - "GetChassisThermals", "GetChassisInventory", "GetHealthReport"], + "GetChassisThermals", "GetChassisInventory", "GetHealthReport", "GetHPEThermalConfig", "GetHPEFanPercentMin"], "Accounts": ["ListUsers"], "Sessions": ["GetSessions"], "Update": ["GetFirmwareInventory", "GetFirmwareUpdateCapabilities", "GetSoftwareInventory", @@ -482,6 +498,10 @@ def main(): result["chassis"] = rf_utils.get_chassis_inventory() elif command == "GetHealthReport": result["health_report"] = rf_utils.get_multi_chassis_health_report() + elif command == "GetHPEThermalConfig": + result["hpe_thermal_config"] = rf_utils.get_hpe_thermal_config() + elif command == "GetHPEFanPercentMin": + result["hpe_fan_percent_min"] = rf_utils.get_hpe_fan_percent_min() elif category == "Accounts": # execute only if we find an Account service resource