Redfish: implement obtaining AccountService config (#9403)
Example result from querying OpenBMC's bmcweb Redfish server: ``` changed: false failed: false redfish_facts: accountservice_config: entries: '@odata.id': /redfish/v1/AccountService '@odata.type': '#AccountService.v1_15_0.AccountService' AccountLockoutDuration: 0 AccountLockoutThreshold: 0 Accounts: '@odata.id': /redfish/v1/AccountService/Accounts ActiveDirectory: Authentication: AuthenticationType: UsernameAndPassword Password: null Username: '' LDAPService: SearchSettings: BaseDistinguishedNames: - '' GroupsAttribute: '' UsernameAttribute: '' RemoteRoleMapping: [] ServiceAddresses: - '' ServiceEnabled: false Description: Account Service HTTPBasicAuth: Enabled HTTPBasicAuth@AllowableValues: - Enabled - Disabled Id: AccountService LDAP: Authentication: AuthenticationType: UsernameAndPassword Password: null Username: '' Certificates: '@odata.id': /redfish/v1/AccountService/LDAP/Certificates LDAPService: SearchSettings: BaseDistinguishedNames: - '' GroupsAttribute: '' UsernameAttribute: '' RemoteRoleMapping: [] ServiceAddresses: - '' ServiceEnabled: false MaxPasswordLength: 20 MinPasswordLength: 8 MultiFactorAuth: ClientCertificate: CertificateMappingAttribute: CommonName Certificates: '@odata.id': /redfish/v1/AccountService/MultiFactorAuth/ClientCertificate/Certificates '@odata.type': '#CertificateCollection.CertificateCollection' Members: [] Members@odata.count: 0 Enabled: true RespondToUnauthenticatedClients: true Name: Account Service Oem: OpenBMC: '@odata.id': /redfish/v1/AccountService#/Oem/OpenBMC '@odata.type': '#OpenBMCAccountService.v1_0_0.AccountService' AuthMethods: BasicAuth: true Cookie: true SessionToken: true TLS: true XToken: true Roles: '@odata.id': /redfish/v1/AccountService/Roles ServiceEnabled: true ret: true ``` Signed-off-by: Paul Fertser <fercerpav@gmail.com>pull/9512/head
parent
655d943dbb
commit
e853bdf6f9
|
@ -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).
|
|
@ -3951,3 +3951,21 @@ class RedfishUtils(object):
|
|||
"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']
|
||||
}
|
||||
|
|
|
@ -199,6 +199,14 @@ EXAMPLES = r"""
|
|||
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 @@ CATEGORY_COMMANDS_ALL = {
|
|||
"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
|
||||
|
|
Loading…
Reference in New Issue