1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add redfish_config command to set service identification (#7917)

* Update redfish_utils.py

* Update redfish_utils.py

* Update redfish_config.py

* Update redfish_config.py

* Update redfish_config.py

* Update redfish_utils.py

* Create 7916-add-redfish-set-service-identification.yml

* fix lint

* Update redfish_utils.py

* add service_id docs

* Update redfish_info.py

* Update plugins/modules/redfish_info.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix conflict

* fix conflict

* fix conflict

* fix conflict

* Update redfish_utils.py

* Update redfish_info.py

* Update redfish_info.py

* Update plugins/modules/redfish_config.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: dh <dh@alpha.stegosaur.org>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
D Honig 2024-02-11 07:16:07 -05:00 committed by GitHub
parent 5af921e8d9
commit eded6ebf64
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 1 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- redfish_config - add command ``SetServiceIdentification`` to set service identification (https://github.com/ansible-collections/community.general/issues/7916).

View file

@ -3408,6 +3408,11 @@ class RedfishUtils(object):
result['ret'] = True
return result
def set_service_identification(self, service_id):
data = {"ServiceIdentification": service_id}
resp = self.patch_request(self.root_uri + '/redfish/v1/Managers/' + self.resource_id, data, check_pyld=True)
return resp
def set_session_service(self, sessions_config):
if sessions_config is None:
return {'ret': False, 'msg':

View file

@ -88,6 +88,12 @@ options:
- ID of the System, Manager or Chassis to modify.
type: str
version_added: '0.2.0'
service_id:
required: false
description:
- ID of the manager to update.
type: str
version_added: '8.4.0'
nic_addr:
required: false
description:
@ -334,6 +340,15 @@ EXAMPLES = '''
RAIDType: "RAID0"
Drives:
- "/redfish/v1/Systems/1/Storage/DE00B000/Drives/1"
- name: Set service identification to {{ service_id }}
community.general.redfish_config:
category: Manager
command: SetServiceIdentification
service_id: "{{ service_id }}"
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
'''
RETURN = '''
@ -353,7 +368,7 @@ from ansible.module_utils.common.text.converters import to_native
CATEGORY_COMMANDS_ALL = {
"Systems": ["SetBiosDefaultSettings", "SetBiosAttributes", "SetBootOrder",
"SetDefaultBootOrder", "EnableSecureBoot", "SetSecureBoot", "DeleteVolumes", "CreateVolume"],
"Manager": ["SetNetworkProtocols", "SetManagerNic", "SetHostInterface"],
"Manager": ["SetNetworkProtocols", "SetManagerNic", "SetHostInterface", "SetServiceIdentification"],
"Sessions": ["SetSessionService"],
}
@ -376,6 +391,7 @@ def main():
default={}
),
resource_id=dict(),
service_id=dict(),
nic_addr=dict(default='null'),
nic_config=dict(
type='dict',
@ -445,6 +461,9 @@ def main():
# HostInterface instance ID
hostinterface_id = module.params['hostinterface_id']
# Service Identification
service_id = module.params['service_id']
# Sessions config options
sessions_config = module.params['sessions_config']
@ -512,6 +531,8 @@ def main():
result = rf_utils.set_manager_nic(nic_addr, nic_config)
elif command == "SetHostInterface":
result = rf_utils.set_hostinterface_attributes(hostinterface_config, hostinterface_id)
elif command == "SetServiceIdentification":
result = rf_utils.set_service_identification(service_id)
elif category == "Sessions":
# execute only if we find a Sessions resource