mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Update redfish module for compatibility with VirtualMedia resource location (#5124)
* Update redfish module for compatibility with VirtualMedia resource location from Manager to Systems * Add changelogs fragments for PR 5124 * Update some issue according to the suggestions * update changelogs fragment to list new features in the minor_changes catagory Co-authored-by: Tami YY3 Pan <panyy3@lenovo.com>
This commit is contained in:
parent
57e1e2bd8e
commit
766c109d47
4 changed files with 93 additions and 18 deletions
|
@ -505,6 +505,20 @@ EXAMPLES = '''
|
|||
username: operator
|
||||
password: supersecretpwd
|
||||
|
||||
- name: Insert Virtual Media
|
||||
community.general.redfish_command:
|
||||
category: Systems
|
||||
command: VirtualMediaInsert
|
||||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
virtual_media:
|
||||
image_url: 'http://example.com/images/SomeLinux-current.iso'
|
||||
media_types:
|
||||
- CD
|
||||
- DVD
|
||||
resource_id: 1
|
||||
|
||||
- name: Insert Virtual Media
|
||||
community.general.redfish_command:
|
||||
category: Manager
|
||||
|
@ -519,6 +533,17 @@ EXAMPLES = '''
|
|||
- DVD
|
||||
resource_id: BMC
|
||||
|
||||
- name: Eject Virtual Media
|
||||
community.general.redfish_command:
|
||||
category: Systems
|
||||
command: VirtualMediaEject
|
||||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
virtual_media:
|
||||
image_url: 'http://example.com/images/SomeLinux-current.iso'
|
||||
resource_id: 1
|
||||
|
||||
- name: Eject Virtual Media
|
||||
community.general.redfish_command:
|
||||
category: Manager
|
||||
|
@ -593,7 +618,7 @@ from ansible.module_utils.common.text.converters import to_native
|
|||
CATEGORY_COMMANDS_ALL = {
|
||||
"Systems": ["PowerOn", "PowerForceOff", "PowerForceRestart", "PowerGracefulRestart",
|
||||
"PowerGracefulShutdown", "PowerReboot", "SetOneTimeBoot", "EnableContinuousBootOverride", "DisableBootOverride",
|
||||
"IndicatorLedOn", "IndicatorLedOff", "IndicatorLedBlink"],
|
||||
"IndicatorLedOn", "IndicatorLedOff", "IndicatorLedBlink", "VirtualMediaInsert", "VirtualMediaEject"],
|
||||
"Chassis": ["IndicatorLedOn", "IndicatorLedOff", "IndicatorLedBlink"],
|
||||
"Accounts": ["AddUser", "EnableUser", "DeleteUser", "DisableUser",
|
||||
"UpdateUserRole", "UpdateUserPassword", "UpdateUserName",
|
||||
|
@ -766,6 +791,10 @@ def main():
|
|||
result = rf_utils.set_boot_override(boot_opts)
|
||||
elif command.startswith('IndicatorLed'):
|
||||
result = rf_utils.manage_system_indicator_led(command)
|
||||
elif command == 'VirtualMediaInsert':
|
||||
result = rf_utils.virtual_media_insert(virtual_media, category)
|
||||
elif command == 'VirtualMediaEject':
|
||||
result = rf_utils.virtual_media_eject(virtual_media, category)
|
||||
|
||||
elif category == "Chassis":
|
||||
result = rf_utils._find_chassis_resource()
|
||||
|
@ -814,9 +843,9 @@ def main():
|
|||
elif command == 'ClearLogs':
|
||||
result = rf_utils.clear_logs()
|
||||
elif command == 'VirtualMediaInsert':
|
||||
result = rf_utils.virtual_media_insert(virtual_media)
|
||||
result = rf_utils.virtual_media_insert(virtual_media, category)
|
||||
elif command == 'VirtualMediaEject':
|
||||
result = rf_utils.virtual_media_eject(virtual_media)
|
||||
result = rf_utils.virtual_media_eject(virtual_media, category)
|
||||
|
||||
elif category == "Update":
|
||||
# execute only if we find UpdateService resources
|
||||
|
|
|
@ -118,6 +118,19 @@ EXAMPLES = '''
|
|||
ansible.builtin.debug:
|
||||
msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}"
|
||||
|
||||
- name: Get Virtual Media information from Systems
|
||||
community.general.redfish_info:
|
||||
category: Systems
|
||||
command: GetVirtualMedia
|
||||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
register: result
|
||||
|
||||
- name: Print fetched information
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}"
|
||||
|
||||
- name: Get Volume Inventory
|
||||
community.general.redfish_info:
|
||||
category: Systems
|
||||
|
@ -303,7 +316,7 @@ CATEGORY_COMMANDS_ALL = {
|
|||
"Systems": ["GetSystemInventory", "GetPsuInventory", "GetCpuInventory",
|
||||
"GetMemoryInventory", "GetNicInventory", "GetHealthReport",
|
||||
"GetStorageControllerInventory", "GetDiskInventory", "GetVolumeInventory",
|
||||
"GetBiosAttributes", "GetBootOrder", "GetBootOverride"],
|
||||
"GetBiosAttributes", "GetBootOrder", "GetBootOverride", "GetVirtualMedia"],
|
||||
"Chassis": ["GetFanInventory", "GetPsuInventory", "GetChassisPower",
|
||||
"GetChassisThermals", "GetChassisInventory", "GetHealthReport"],
|
||||
"Accounts": ["ListUsers"],
|
||||
|
@ -420,6 +433,8 @@ def main():
|
|||
result["boot_override"] = rf_utils.get_multi_boot_override()
|
||||
elif command == "GetHealthReport":
|
||||
result["health_report"] = rf_utils.get_multi_system_health_report()
|
||||
elif command == "GetVirtualMedia":
|
||||
result["virtual_media"] = rf_utils.get_multi_virtualmedia(category)
|
||||
|
||||
elif category == "Chassis":
|
||||
# execute only if we find Chassis resource
|
||||
|
@ -485,7 +500,7 @@ def main():
|
|||
if command == "GetManagerNicInventory":
|
||||
result["manager_nics"] = rf_utils.get_multi_nic_inventory(category)
|
||||
elif command == "GetVirtualMedia":
|
||||
result["virtual_media"] = rf_utils.get_multi_virtualmedia()
|
||||
result["virtual_media"] = rf_utils.get_multi_virtualmedia(category)
|
||||
elif command == "GetLogs":
|
||||
result["log"] = rf_utils.get_logs()
|
||||
elif command == "GetNetworkProtocols":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue