mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-22 18:31:25 -07:00
[PR #6604/16abb96b backport][stable-7] New Proxmox VE modules to handle pools and their membership (#6621)
New Proxmox VE modules to handle pools and their membership (#6604)
* New Proxmox VE modules to handle pools and their membership
* Fix pep8 linting errors
* Fix pep8 and compatibility errors
* Add required fields in the documentation
* Typo fix
* Fix pylint errors
* Fix the last one error
* Address review comments
* Fix linting error
* Add integration tests playbook
* Add assert for the diff mode
* Address review comments
* Fix typo in the word
* Fail for non-empty pool even in check_mode
(cherry picked from commit 16abb96bd8
)
Co-authored-by: Sergei Antipov <s.antipov@mulesoft.com>
This commit is contained in:
parent
1a35fb1d77
commit
75a69de909
7 changed files with 675 additions and 1 deletions
|
@ -145,3 +145,25 @@ class ProxmoxAnsible(object):
|
|||
def api_task_ok(self, node, taskid):
|
||||
status = self.proxmox_api.nodes(node).tasks(taskid).status.get()
|
||||
return status['status'] == 'stopped' and status['exitstatus'] == 'OK'
|
||||
|
||||
def get_pool(self, poolid):
|
||||
"""Retrieve pool information
|
||||
|
||||
:param poolid: str - name of the pool
|
||||
:return: dict - pool information
|
||||
"""
|
||||
try:
|
||||
return self.proxmox_api.pools(poolid).get()
|
||||
except Exception as e:
|
||||
self.module.fail_json(msg="Unable to retrieve pool %s information: %s" % (poolid, e))
|
||||
|
||||
def get_storages(self, type):
|
||||
"""Retrieve storages information
|
||||
|
||||
:param type: str, optional - type of storages
|
||||
:return: list of dicts - array of storages
|
||||
"""
|
||||
try:
|
||||
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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue