cs_storage_pool - Manages Primary Storage Pools on Apache CloudStack based clouds.

New in version 2.4.

Synopsis

  • Create, update, put into maintenance, disable, enable and remove storage pools.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • cs >= 0.6.10

Parameters

Parameter Choices/Defaults Comments
allocation_state
    Choices:
  • enabled
  • disabled
Allocation state of the storage pool.
api_http_method
    Choices:
  • get
  • post
HTTP method used to query the API endpoint.
If not given, the CLOUDSTACK_METHOD env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
Fallback value is get if not specified.
api_key
API key of the CloudStack API.
If not given, the CLOUDSTACK_KEY env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
api_region Default:
"cloudstack"
Name of the ini section in the cloustack.ini file.
If not given, the CLOUDSTACK_REGION env variable is considered.
api_secret
Secret key of the CloudStack API.
If not set, the CLOUDSTACK_SECRET env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
api_timeout
HTTP timeout in seconds.
If not given, the CLOUDSTACK_TIMEOUT env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
Fallback value is 10 seconds if not specified.
api_url
URL of the CloudStack API e.g. https://cloud.example.com/client/api.
If not given, the CLOUDSTACK_ENDPOINT env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
capacity_bytes
Bytes CloudStack can provision from this storage pool.
capacity_iops
Bytes CloudStack can provision from this storage pool.
cluster
Name of the cluster.
hypervisor
    Choices:
  • KVM
  • VMware
  • BareMetal
  • XenServer
  • LXC
  • HyperV
  • UCS
  • OVM
  • Simulator
Required when creating a zone scoped pool.
managed
Whether the storage pool should be managed by CloudStack.
Only considere on creation.
name
required
Name of the storage pool.
pod
Name of the pod.
provider Default:
"DefaultPrimary"
Name of the storage provider e.g. SolidFire, SolidFireShared, DefaultPrimary, CloudByte.
scope
    Choices:
  • cluster
  • zone
The scope of the storage pool.
Defaults to cluster when cluster is provided, otherwise zone.
state
    Choices:
  • present
  • absent
State of the storage pool.
storage_tags
Tags associated with this storage pool.
storage_url
URL of the storage pool.
Required if state=present.
zone
Name of the zone in which the host should be deployed.
If not set, default zone is used.

Notes

Note

  • Ansible uses the cs library’s configuration method if credentials are not provided by the arguments api_url, api_key, api_secret. Configuration is read from several locations, in the following order. The CLOUDSTACK_ENDPOINT, CLOUDSTACK_KEY, CLOUDSTACK_SECRET and CLOUDSTACK_METHOD. CLOUDSTACK_TIMEOUT environment variables. A CLOUDSTACK_CONFIG environment variable pointing to an .ini file. A cloudstack.ini file in the current working directory. A .cloudstack.ini file in the users home directory. Optionally multiple credentials and endpoints can be specified using ini sections in cloudstack.ini. Use the argument api_region to select the section name, default section is cloudstack. See https://github.com/exoscale/cs for more information.
  • A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.
  • This module supports check mode.

Examples

- name: ensure a zone scoped storage_pool is present
  local_action:
    module: cs_storage_pool
    zone: zone01
    storage_url: rbd://admin:[email protected]/poolname
    provider: DefaultPrimary
    name: Ceph RBD
    scope: zone
    hypervisor: KVM

- name: ensure a cluster scoped storage_pool is disabled
  local_action:
    module: cs_storage_pool
    name: Ceph RBD
    zone: zone01
    cluster: cluster01
    pod: pod01
    storage_url: rbd://admin:[email protected]/poolname
    provider: DefaultPrimary
    scope: cluster
    allocation_state: disabled

- name: ensure a cluster scoped storage_pool is in maintenance
  local_action:
    module: cs_storage_pool
    name: Ceph RBD
    zone: zone01
    cluster: cluster01
    pod: pod01
    storage_url: rbd://admin:[email protected]/poolname
    provider: DefaultPrimary
    scope: cluster
    allocation_state: maintenance

- name: ensure a storage_pool is absent
  local_action:
    module: cs_storage_pool
    name: Ceph RBD
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
allocation_state
string
success
The state of the storage pool.

Sample:
enabled
capacity_iops
int
when available
IOPS CloudStack can provision from this storage pool

Sample:
60000
cluster
string
when scope is cluster
The name of the cluster.

Sample:
Cluster01
created
string
success
Date of the pool was created.

Sample:
2014-12-01T14:57:57+0100
disk_size_allocated
int
success
The pool's currently allocated disk space.

Sample:
2443517624320
disk_size_total
int
success
The total size of the pool.

Sample:
3915055693824
disk_size_used
int
success
The pool's currently used disk size.

Sample:
1040862622180
hypervisor
string
when available
Hypervisor related to this storage pool.

Sample:
KVM
id
string
success
UUID of the pool.

Sample:
a3fca65a-7db1-4891-b97c-48806a978a96
overprovision_factor
string
success
The overprovision factor of the storage pool.

Sample:
2.0
path
string
success
The storage pool path used in the storage_url.

Sample:
poolname
pod
string
when scope is cluster
The name of the pod.

Sample:
Cluster01
scope
string
success
The scope of the storage pool.

Sample:
cluster
state
string
success
The state of the storage pool as returned by the API.

Sample:
Up
storage_capabilities
dict
success
Capabilities of the torage pool.

Sample:
{'VOLUME_SNAPSHOT_QUIESCEVM': 'false'}
storage_tags
list
success
the tags for the storage pool.

Sample:
['perf', 'ssd']
suitable_for_migration
bool
success
Whether the storage pool is suitable to migrate a volume or not.

zone
string
success
The name of the zone.

Sample:
Zone01


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Netservers Ltd. (@netservers)
  • René Moser (@resmo)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.6/modules/cs_storage_pool_module.html