mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-18 16:31:26 -07:00
Adding DeleteVolumes functionality (#6814)
* Adding DeleteAllVolumes functionality * Adding changelog fragment and sanity fix * Sanity Fix * Updating as per PR suggestions * Sanity fix * Adjust version_added. --------- Co-authored-by: Kushal <t-s.kushal@hpe.com> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
4b17fd4265
commit
478652843f
3 changed files with 98 additions and 2 deletions
|
@ -130,7 +130,21 @@ options:
|
|||
type: dict
|
||||
default: {}
|
||||
version_added: '5.7.0'
|
||||
|
||||
storage_subsystem_id:
|
||||
required: false
|
||||
description:
|
||||
- Id of the Storage Subsystem on which the volume is to be created.
|
||||
type: str
|
||||
default: ''
|
||||
version_added: '7.3.0'
|
||||
volume_ids:
|
||||
required: false
|
||||
description:
|
||||
- List of IDs of volumes to be deleted.
|
||||
type: list
|
||||
default: []
|
||||
elements: str
|
||||
version_added: '7.3.0'
|
||||
author:
|
||||
- "Jose Delarosa (@jose-delarosa)"
|
||||
- "T S Kushal (@TSKushal)"
|
||||
|
@ -272,6 +286,16 @@ EXAMPLES = '''
|
|||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
|
||||
- name: Delete All Volumes
|
||||
community.general.redfish_config:
|
||||
category: Systems
|
||||
command: DeleteVolumes
|
||||
baseuri: "{{ baseuri }}"
|
||||
username: "{{ username }}"
|
||||
password: "{{ password }}"
|
||||
storage_subsystem_id: "DExxxxxx"
|
||||
volume_ids: ["volume1", "volume2"]
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
@ -290,7 +314,7 @@ from ansible.module_utils.common.text.converters import to_native
|
|||
# More will be added as module features are expanded
|
||||
CATEGORY_COMMANDS_ALL = {
|
||||
"Systems": ["SetBiosDefaultSettings", "SetBiosAttributes", "SetBootOrder",
|
||||
"SetDefaultBootOrder", "EnableSecureBoot"],
|
||||
"SetDefaultBootOrder", "EnableSecureBoot", "DeleteVolumes"],
|
||||
"Manager": ["SetNetworkProtocols", "SetManagerNic", "SetHostInterface"],
|
||||
"Sessions": ["SetSessionService"],
|
||||
}
|
||||
|
@ -323,6 +347,8 @@ def main():
|
|||
hostinterface_config=dict(type='dict', default={}),
|
||||
hostinterface_id=dict(),
|
||||
sessions_config=dict(type='dict', default={}),
|
||||
storage_subsystem_id=dict(type='str', default=''),
|
||||
volume_ids=dict(type='list', default=[], elements='str')
|
||||
),
|
||||
required_together=[
|
||||
('username', 'password'),
|
||||
|
@ -372,6 +398,10 @@ def main():
|
|||
# Sessions config options
|
||||
sessions_config = module.params['sessions_config']
|
||||
|
||||
# Volume deletion options
|
||||
storage_subsystem_id = module.params['storage_subsystem_id']
|
||||
volume_ids = module.params['volume_ids']
|
||||
|
||||
# Build root URI
|
||||
root_uri = "https://" + module.params['baseuri']
|
||||
rf_utils = RedfishUtils(creds, root_uri, timeout, module,
|
||||
|
@ -405,6 +435,8 @@ def main():
|
|||
result = rf_utils.set_default_boot_order()
|
||||
elif command == "EnableSecureBoot":
|
||||
result = rf_utils.enable_secure_boot()
|
||||
elif command == "DeleteVolumes":
|
||||
result = rf_utils.delete_volumes(storage_subsystem_id, volume_ids)
|
||||
|
||||
elif category == "Manager":
|
||||
# execute only if we find a Manager service resource
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue