mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-30 12:59:09 -07:00
Proxmox add storage content listing (#7725)
Add module to list content on proxmox storage
We first add a method to list storage content for proxmox, then use that
new methode to add an Ansible module to list content on storage attached
to a proxmox node. User can also use content filtering to define what
they want to list (backup, iso, images,...).
This commit also include the integration and unit test for that new
module.
Co-authored-by: Julian Vanden Broeck <julian.vandenbroeck@dalibo.com>
(cherry picked from commit 4f92f39720
)
Co-authored-by: Julian <374571+l00ptr@users.noreply.github.com>
This commit is contained in:
parent
89c56631c8
commit
d423b27288
5 changed files with 269 additions and 0 deletions
|
@ -180,3 +180,17 @@ class ProxmoxAnsible(object):
|
|||
return self.proxmox_api.storage.get(type=type)
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg="Unable to retrieve storages information with type %s: %s" % (type, e))
|
||||
|
||||
def get_storage_content(self, node, storage, content=None, vmid=None):
|
||||
try:
|
||||
return (
|
||||
self.proxmox_api.nodes(node)
|
||||
.storage(storage)
|
||||
.content()
|
||||
.get(content=content, vmid=vmid)
|
||||
)
|
||||
except Exception as e:
|
||||
self.module.fail_json(
|
||||
msg="Unable to list content on %s, %s for %s and %s: %s"
|
||||
% (node, storage, content, vmid, e)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue