mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 21:31:26 -07:00
redfish_config: Add support to configure Redfish Host Interface (#3632)
* redfish_config: Add support to configure Redfish Host Interface Adding another Manager command to redfish_config in order to set Redfish Host Interface properties. Fixes #3631 * add fragment * fixup for fragment filename * Update plugins/modules/remote_management/redfish/redfish_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Add support for specifying HostInterface resource ID * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/remote_management/redfish/redfish_config.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/3632-add-redfish-host-interface-config-support.yml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
5948809162
commit
6f47ddc29f
3 changed files with 130 additions and 1 deletions
|
@ -100,6 +100,18 @@ options:
|
|||
type: bool
|
||||
default: false
|
||||
version_added: 3.7.0
|
||||
hostinterface_config:
|
||||
required: false
|
||||
description:
|
||||
- Setting dict of HostInterface on OOB controller.
|
||||
type: dict
|
||||
version_added: '4.1.0'
|
||||
hostinterface_id:
|
||||
required: false
|
||||
description:
|
||||
- Redfish HostInterface instance ID if multiple HostInterfaces are present.
|
||||
type: str
|
||||
version_added: '4.1.0'
|
||||
|
||||
author: "Jose Delarosa (@jose-delarosa)"
|
||||
'''
|
||||
|
@ -201,6 +213,27 @@ EXAMPLES = '''
|
|||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
|
||||
- name: Disable Host Interface
|
||||
community.general.redfish_config:
|
||||
category: Manager
|
||||
command: SetHostInterface
|
||||
hostinterface_config:
|
||||
InterfaceEnabled: false
|
||||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
|
||||
- name: Enable Host Interface for HostInterface resource ID '2'
|
||||
community.general.redfish_config:
|
||||
category: Manager
|
||||
command: SetHostInterface
|
||||
hostinterface_config:
|
||||
InterfaceEnabled: true
|
||||
hostinterface_id: "2"
|
||||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
@ -220,7 +253,7 @@ from ansible.module_utils.common.text.converters import to_native
|
|||
CATEGORY_COMMANDS_ALL = {
|
||||
"Systems": ["SetBiosDefaultSettings", "SetBiosAttributes", "SetBootOrder",
|
||||
"SetDefaultBootOrder"],
|
||||
"Manager": ["SetNetworkProtocols", "SetManagerNic"]
|
||||
"Manager": ["SetNetworkProtocols", "SetManagerNic", "SetHostInterface"]
|
||||
}
|
||||
|
||||
|
||||
|
@ -248,6 +281,8 @@ def main():
|
|||
default={}
|
||||
),
|
||||
strip_etag_quotes=dict(type='bool', default=False),
|
||||
hostinterface_config=dict(type='dict', default={}),
|
||||
hostinterface_id=dict(),
|
||||
),
|
||||
required_together=[
|
||||
('username', 'password'),
|
||||
|
@ -288,6 +323,12 @@ def main():
|
|||
# Etag options
|
||||
strip_etag_quotes = module.params['strip_etag_quotes']
|
||||
|
||||
# HostInterface config options
|
||||
hostinterface_config = module.params['hostinterface_config']
|
||||
|
||||
# HostInterface instance ID
|
||||
hostinterface_id = module.params['hostinterface_id']
|
||||
|
||||
# Build root URI
|
||||
root_uri = "https://" + module.params['baseuri']
|
||||
rf_utils = RedfishUtils(creds, root_uri, timeout, module,
|
||||
|
@ -331,6 +372,8 @@ def main():
|
|||
result = rf_utils.set_network_protocols(module.params['network_protocols'])
|
||||
elif command == "SetManagerNic":
|
||||
result = rf_utils.set_manager_nic(nic_addr, nic_config)
|
||||
elif command == "SetHostInterface":
|
||||
result = rf_utils.set_hostinterface_attributes(hostinterface_config, hostinterface_id)
|
||||
|
||||
# Return data back or fail with proper message
|
||||
if result['ret'] is True:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue