gcore.cloud.volume_snapshot (1.0.1) — module

Manages snapshots

Authors: GCore (@GCore)

Install collection

Install with ansible-galaxy collection install gcore.cloud:==1.0.1


Add to requirements.yml

  collections:
    - name: gcore.cloud
      version: 1.0.1

Description

Create or delete snapshot for volume

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new snapshot
  gcore.cloud.volume_snapshot:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: create
    volume_id: "{{ volume_id }}"
    name: "test-snap"
    description: "after boot"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete snapshot
  gcore.cloud.volume_snapshot:
    api_key: "{{ api_key }}"
    region_id: "{{ region_id }}"
    project_id: "{{ project_id }}"
    command: delete
    snapshot_id: "{{ snapshot_id }}"

Inputs

    
name:
    description:
    - Snapshot name.
    - Required if I(command) is create.
    required: false
    type: str

api_key:
    description:
    - GCore API auth key
    - Can be passed as I(CLOUD_API_KEY) environment variable.
    type: str

command:
    choices:
    - create
    - delete
    description:
    - Operation to perform.
    required: true
    type: str

api_host:
    default: https://api.gcore.com/cloud
    description:
    - GCore API base host
    - Can be passed as I(CLOUD_API_HOST) environment variable.
    type: str

metadata:
    description:
    - Snapshot metadata.
    - Used if I(command) is create.
    required: false
    type: dict

region_id:
    description:
    - GCore API region ID
    - Required if I(region_name) is not passed
    - Can be passed as I(CLOUD_REGION_ID) environment variable.
    type: int

volume_id:
    description:
    - Volume ID to make snapshot of.
    - Required if I(command) is create
    required: false
    type: str

project_id:
    description:
    - GCore API project ID
    - Required if I(project_name) is not passed
    - Can be passed as I(CLOUD_PROJECT_ID) environment variable.
    type: int

api_timeout:
    default: 30
    description:
    - Timeout in seconds to polling GCore API
    type: int

description:
    description:
    - Snapshot description.
    - Used if I(command) is create.
    required: false
    type: str

region_name:
    description:
    - GCore API region name
    - Required if I(region_id) is not passed
    - Can be passed as I(CLOUD_REGION_NAME) environment variable.
    type: str

snapshot_id:
    description:
    - Snapshot ID.
    - Required if I(command) is delete
    required: false
    type: str

project_name:
    description:
    - GCore API project name
    - Required if I(project_id) is not passed
    - Can be passed as I(CLOUD_PROJECT_NAME) environment variable.
    type: str

Outputs

volume_snapshot:
  contains:
    created_at:
      description: Datetime when the volume was created
      returned: always
      sample: 2019-05-29T05:32:41+0000
      type: str
    creator_task_id:
      description: Task that created this entity
      returned: if available
      sample: 2358e3b1-5c42-4705-8950-6ddcfc19c3bd
      type: str
    description:
      description: Snapshot description
      returned: if available
      sample: test
      type: str
    id:
      description: Snapshot ID
      returned: always
      sample: 726ecfcc-7fd0-4e30-a86e-7892524aa483
      type: str
    metadata:
      description: Metadata
      returned: if available
      sample:
        bootable: 'False'
        task_id: a4d72afa-1c67-44af-9f91-0b893cd204da
        volume_name: namevolume
        volume_type: standard
      type: dict
    name:
      description: Snapshot name
      returned: always
      sample: test
      type: str
    project_id:
      description: Project ID
      returned: always
      sample: 1
      type: int
    region:
      description: Region name
      returned: always
      sample: Luxembourg 1
      type: str
    region_id:
      description: Region ID
      returned: always
      sample: 1
      type: int
    size:
      description: Snapshot size, GiB
      returned: always
      sample: 2
      type: int
    status:
      description: Snapshot status
      returned: always
      sample: available
      type: str
    task_id:
      description: Active task. If None, action has been performed immediately in
        the request itself
      returned: if available
      sample: 907a87b0-7b63-4fd5-beb3-5ab4ba445c93
      type: str
    updated_at:
      description: Datetime when the volume was last updated
      returned: if available
      sample: 2019-05-29T05:39:20+0000
      type: str
    volume_id:
      description: ID of the volume this snapshot was made from
      returned: always
      sample: 67baa7d1-08ea-4fc5-bef2-6b2465b7d227
      type: str
  description:
  - Response depends of I(command).
  - If I(command) is create then response will be a dict of resource.
  - If I(command) is delete then response will be a dict of resource ID.
  returned: always
  type: complex

See also