Skip to content

Latest commit

 

History

History
108 lines (91 loc) · 4.39 KB

volume.md

File metadata and controls

108 lines (91 loc) · 4.39 KB

volume

Manage a Linode Volume.

Minimum Required Fields

Field Type Required Description
api_token str Required The Linode account personal access token. It is necessary to run the module.
It can be exposed by the environment variable LINODE_API_TOKEN instead.
See details in Usage.

Examples

- name: Create a volume attached to an instance
  linode.cloud.volume:
    label: example-volume
    region: us-east
    size: 30
    linode_id: 12345
    state: present
- name: Create an unattached volume
  linode.cloud.volume:
    label: example-volume
    region: us-east
    size: 30
    state: present
- name: Resize a volume
  linode.cloud.volume:
    label: example-volume
    size: 50
    state: present
- name: Detach a volume
  linode.cloud.volume:
    label: example-volume
    attached: false
    state: present
- name: Delete a volume
  linode.cloud.volume:
    label: example-volume
    state: absent
- name: Create an cloned volume
  linode.cloud.volume: 
    source_volume_id: 1234
    label: example-volume
    region: us-east
    size: 30
    state: present

Parameters

Field Type Required Description
state str Required The desired state of the target. (Choices: present, absent)
label str Optional The Volume’s label, which is also used in the filesystem_path of the resulting volume.
config_id int Optional When creating a Volume attached to a Linode, the ID of the Linode Config to include the new Volume in.
linode_id int Optional The Linode this volume should be attached to upon creation. If not given, the volume will be created without an attachment. (Updatable)
region str Optional The location to deploy the volume in. See https://api.linode.com/v4/regions
size int Optional The size of this volume, in GB. Be aware that volumes may only be resized up after creation. (Updatable)
attached bool Optional If true, the volume will be attached to a Linode. Otherwise, the volume will be detached. (Default: True; Updatable)
wait_timeout int Optional The amount of time, in seconds, to wait for a volume to have the active status. (Default: 240)
source_volume_id int Optional The volume id of the desired volume to clone.
tags list Optional The tags to be attached to the volume.

Return Values

  • volume - The volume in JSON serialized form.

    • Sample Response:
      {
        "created": "2018-01-01T00:01:01",
        "filesystem_path": "/dev/disk/by-id/scsi-0Linode_Volume_my-volume",
        "hardware_type": "nvme",
        "id": 12345,
        "label": "my-volume",
        "linode_id": 12346,
        "linode_label": "linode123",
        "region": "us-east",
        "size": 30,
        "status": "active",
        "tags": [
          "example tag",
          "another example"
        ],
        "updated": "2018-01-01T00:01:01"
      }
    • See the Linode API response documentation for a list of returned fields