[stable-8] Proxmox add storage content listing (#7725) (#7803)

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:
Felix Fontein 2023-12-31 15:43:43 +01:00 committed by GitHub
parent 89c56631c8
commit d423b27288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 269 additions and 0 deletions

View file

@ -129,6 +129,25 @@
- results_storage.proxmox_storages|length == 1
- results_storage.proxmox_storages[0].storage == "{{ storage }}"
- name: List content on storage
proxmox_storage_contents_info:
api_host: "{{ api_host }}"
api_user: "{{ user }}@{{ domain }}"
api_password: "{{ api_password | default(omit) }}"
api_token_id: "{{ api_token_id | default(omit) }}"
api_token_secret: "{{ api_token_secret | default(omit) }}"
validate_certs: "{{ validate_certs }}"
storage: "{{ storage }}"
node: "{{ node }}"
content: images
register: results_list_storage
- assert:
that:
- results_storage is not changed
- results_storage.proxmox_storage_content is defined
- results_storage.proxmox_storage_content |length == 1
- name: VM creation
tags: [ 'create' ]
block: