hwceco.hwcollection.hwc_evs_disk – Creates a resource of Evs/Disk in Huawei Cloud

Note

This plugin is part of the hwceco.hwcollection collection (version 1.0.5).

To install it use: ansible-galaxy collection install hwceco.hwcollection.

To use it in a playbook, specify: hwceco.hwcollection.hwc_evs_disk.

New in version 1.0.0: of hwceco.hwcollection

Synopsis

  • Creates and manages a resource of Evs/Disk in Huawei Cloud.

Requirements

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

  • huaweicloudsdkcore >= 3.0.47

  • huaweicloudsdkevs >= 3.0.47

Parameters

Parameter Choices/Defaults Comments
access_key
string / required
Specifies the access key of the HuaweiCloud to use.
availability_zone
string / required
Specifies the AZ where you want to create the disk.
backup_id
string
Specifies the ID of the backup that can be used to create a disk. This parameter is mandatory when you use a backup to create the disk.
cloud
string
Default:
"myhuaweicloud.com"
Specifies the endpoint of the cloud. Required if you are using other cloud supported by Huaweicloud.
description
string
Specifies the disk description. The value can contain a maximum of 255 bytes.
enable_full_clone
boolean
    Choices:
  • no
  • yes
If the disk is created from a snapshot and linked cloning needs to be used, set this parameter to True.
enable_scsi
boolean
    Choices:
  • no
  • yes
If this parameter is set to True, the disk device type will be SCSI, which allows ECS OSs to directly access underlying storage media. SCSI reservation command is supported. If this parameter is set to False, the disk device type will be VBD, which supports only simple SCSI read/write commands.
NOTE: If parameter enable_share is set to True and this parameter is not specified, shared SCSI disks are created. SCSI EVS disks cannot be created from backups, which means that this parameter cannot be True if backup_id has been specified.
enable_share
boolean
    Choices:
  • no
  • yes
Specifies whether the disk is shareable. The default value is False.
encryption_id
string
Specifies the encryption ID. The length of it fixes at 36 bytes.
enterprise_project_id
string
Specifies the enterprise project ID. This ID is associated with the disk during the disk creation. If it is not specified, the disk is bound to the default enterprise project.
filters
string / required
A list of filters to apply when deciding whether existing resources match and should be altered. The item of filters is the name of input options.
identity_endpoint
string
Default:
"https://iam.myhuaweicloud.com:443/v3"
Specifies the Identity authentication URL. Required if you are using other cloud supported by Huaweicloud.
image_id
string
Specifies the image ID. If this parameter is specified, the disk is created from an image.
NOTE: BMS system disks cannot be created from BMS images.
name
string / required
Specifies the disk name. The value can contain a maximum of 255 bytes.
project_id
string / required
Specifies the of ID of the project to login with.
region
string / required
Specifies the Huawei Cloud region.
secret_key
string / required
Specifies the secret key of the HuaweiCloud to use.
size
string
Specifies the disk size, in GB. Its values are as follows: System disk: 1 GB to 1024 GB, Data disk: 10 GB to 32768 GB. This parameter is mandatory when you create an empty disk or use an image or a snapshot to create a disk. If you use an image or a snapshot to create a disk, the disk size must be greater than or equal to the image or snapshot size. This parameter is optional when you use a backup to create a disk. If this parameter is not specified, the disk size is equal to the backup size.
snapshot_id
string
Specifies the snapshot ID. If this parameter is specified, the disk is created from a snapshot.
state
string
    Choices:
  • present ←
  • absent
Whether the given object should exist in Huawei Cloud.
timeouts
dictionary
The timeouts for each operations.
create
string
Default:
"30m"
The timeouts for create operation.
delete
string
Default:
"30m"
The timeouts for delete operation.
update
string
Default:
"30m"
The timeouts for update operation.
volume_type
string / required
Specifies the disk type. Currently, the value can be SSD, SAS, or SATA.
SSD: specifies the ultra-high I/O disk type.
SAS: specifies the high I/O disk type.
SATA: specifies the common I/O disk type.
NOTE: If the specified disk type is not available in the AZ, the disk will fail to create. If the EVS disk is created from a snapshot, the volume_type field must be the same as that of the snapshot's source disk.

Notes

Note

  • For authentication, you can set access_key using the `ANSIBLE_HWC_ACCESS_KEY’ env variable.

  • For authentication, you can set secret_key using the `ANSIBLE_HWC_SECRET_KEY’ env variable.

  • For authentication, you can set project_id using the `ANSIBLE_HWC_PROJECT_ID’ env variable.

  • For authentication, you can set region using the `ANSIBLE_HWC_REGION’ env variable.

  • For authentication, you can set identity_endpoint using the `ANSIBLE_HWC_IDENTITY_ENDPOINT’ env variable.

  • For authentication, you can set cloud using the `ANSIBLE_HWC_CLOUD’ env variable.

  • Environment variables values will only be used if the playbook values are not set.

Examples

# test create disk
- name: create a disk
  hwc_evs_disk:
    filters:
      - "name"
    availability_zone: "cn-north-1a"
    name: "ansible_evs_disk_test"
    volume_type: "SATA"
    size: 10

Return Values

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

Key Returned Description
attachments
dictionary
success
Specifies the disk attachment information.

 
attached_at
string
success
Specifies the time when the disk was attached. Time format: UTC YYYY-MM-DDTHH:MM:SS.

 
attachment_id
string
success
Specifies the ID of the attachment information.

 
device
string
success
Specifies the device name.

 
server_id
string
success
Specifies the ID of the server to which the disk is attached.

availability_zone
string
success
Specifies the AZ where you want to create the disk.

backup_id
string
success
Specifies the ID of the backup that can be used to create a disk. This parameter is mandatory when you use a backup to create the disk.

backup_policy_id
string
success
Specifies the backup policy ID.

created_at
string
success
Specifies the time when the disk was created. Time format: UTC YYYY-MM-DDTHH:MM:SS.

description
string
success
Specifies the disk description. The value can contain a maximum of 255 bytes.

enable_full_clone
boolean
success
If the disk is created from a snapshot and linked cloning needs to be used, set this parameter to True.

enable_scsi
boolean
success
If this parameter is set to True, the disk device type will be SCSI, which allows ECS OSs to directly access underlying storage media. SCSI reservation command is supported. If this parameter is set to False, the disk device type will be VBD, which supports only simple SCSI read/write commands.
NOTE: If parameter enable_share is set to True and this parameter is not specified, shared SCSI disks are created. SCSI EVS disks cannot be created from backups, which means that this parameter cannot be True if backup_id has been specified.

enable_share
boolean
success
Specifies whether the disk is shareable. The default value is False.

encryption_id
string
success
Specifies the encryption ID. The length of it fixes at 36 bytes.

enterprise_project_id
string
success
Specifies the enterprise project ID. This ID is associated with the disk during the disk creation. If it is not specified, the disk is bound to the default enterprise project.

image_id
string
success
Specifies the image ID. If this parameter is specified, the disk is created from an image. NOTE: BMS system disks cannot be created from BMS images.

is_bootable
boolean
success
Specifies whether the disk is bootable.

is_readonly
boolean
success
Specifies whether the disk is read-only or read/write. True: indicates that the disk is read-only. False: indicates that the disk is read/write.

name
string
success
Specifies the disk name. The value can contain a maximum of 255 bytes.

size
integer
success
Specifies the disk size, in GB. Its values are as follows: System disk: 1 GB to 1024 GB, Data disk: 10 GB to 32768 GB. This parameter is mandatory when you create an empty disk or use an image or a snapshot to create a disk. If you use an image or a snapshot to create a disk, the disk size must be greater than or equal to the image or snapshot size. This parameter is optional when you use a backup to create a disk. If this parameter is not specified, the disk size is equal to the backup size.

snapshot_id
string
success
Specifies the snapshot ID. If this parameter is specified, the disk is created from a snapshot.

source_volume_id
string
success
Specifies the source disk ID. This parameter has a value if the disk is created from a source disk.

status
string
success
Specifies the disk status.

tags
dictionary
success
Specifies the disk tags.

volume_type
string
success
Specifies the disk type. Currently, the value can be SSD, SAS, or SATA.
SSD: specifies the ultra-high I/O disk type.
SAS: specifies the high I/O disk type.
SATA: specifies the common I/O disk type.
NOTE: If the specified disk type is not available in the AZ, the disk will fail to create. If the EVS disk is created from a snapshot, the volume_type field must be the same as that of the snapshot's source disk.



Authors

  • Huawei (@huaweicloud)