diff --git a/changelogs/fragments/9403-redfish-add-get-accountservice.yml b/changelogs/fragments/9403-redfish-add-get-accountservice.yml new file mode 100644 index 00000000000..a57ecfec614 --- /dev/null +++ b/changelogs/fragments/9403-redfish-add-get-accountservice.yml @@ -0,0 +1,2 @@ +minor_changes: + - redfish_info - add command ``GetAccountServiceConfig`` to get full information about AccountService configuration (https://github.com/ansible-collections/community.general/pull/9403). diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index 253395ea93c..085d938f57f 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -3951,3 +3951,21 @@ def check_location_uri(self, resp_data, resp_uri): "rsp_uri": rsp_uri } return res + + def get_accountservice_properties(self): + # Find the AccountService resource + response = self.get_request(self.root_uri + self.service_root) + if response['ret'] is False: + return response + data = response['data'] + accountservice_uri = data.get("AccountService", {}).get("@odata.id") + if accountservice_uri is None: + return {'ret': False, 'msg': "AccountService resource not found"} + + response = self.get_request(self.root_uri + accountservice_uri) + if response['ret'] is False: + return response + return { + 'ret': True, + 'entries': response['data'] + } diff --git a/plugins/modules/redfish_info.py b/plugins/modules/redfish_info.py index e4e909ad484..cd8521f2da0 100644 --- a/plugins/modules/redfish_info.py +++ b/plugins/modules/redfish_info.py @@ -199,6 +199,14 @@ username: "{{ username }}" password: "{{ password }}" +- name: Get configuration of the AccountService + community.general.redfish_info: + category: Accounts + command: GetAccountServiceConfig + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + - name: Get default system inventory and user information community.general.redfish_info: category: Systems,Accounts @@ -396,7 +404,7 @@ "GetBiosAttributes", "GetBootOrder", "GetBootOverride", "GetVirtualMedia", "GetBiosRegistries"], "Chassis": ["GetFanInventory", "GetPsuInventory", "GetChassisPower", "GetChassisThermals", "GetChassisInventory", "GetHealthReport", "GetHPEThermalConfig", "GetHPEFanPercentMin"], - "Accounts": ["ListUsers"], + "Accounts": ["ListUsers", "GetAccountServiceConfig"], "Sessions": ["GetSessions"], "Update": ["GetFirmwareInventory", "GetFirmwareUpdateCapabilities", "GetSoftwareInventory", "GetUpdateStatus"], @@ -569,6 +577,8 @@ def main(): for command in command_list: if command == "ListUsers": result["user"] = rf_utils.list_users() + elif command == "GetAccountServiceConfig": + result["accountservice_config"] = rf_utils.get_accountservice_properties() elif category == "Update": # execute only if we find UpdateService resources