community.general.cs_vmsnapshot (0.1.1) — module

Manages VM snapshots on Apache CloudStack based clouds.

Authors: René Moser (@resmo)

stableinterface | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

Create, remove and revert VM from snapshots.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a VM snapshot of disk and memory before an upgrade
  cs_vmsnapshot:
    name: Snapshot before upgrade
    vm: web-01
    snapshot_memory: yes
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Revert a VM to a snapshot after a failed upgrade
  cs_vmsnapshot:
    name: Snapshot before upgrade
    vm: web-01
    state: revert
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a VM snapshot after successful upgrade
  cs_vmsnapshot:
    name: Snapshot before upgrade
    vm: web-01
    state: absent
  delegate_to: localhost

Inputs

    
vm:
    description:
    - Name of the virtual machine.
    required: true
    type: str

name:
    aliases:
    - display_name
    description:
    - Unique Name of the snapshot. In CloudStack terms display name.
    required: true
    type: str

tags:
    aliases:
    - tag
    description:
    - List of tags. Tags are a list of dictionaries having keys I(key) and I(value).
    - 'To delete all tags, set a empty list e.g. I(tags: []).'
    type: list

zone:
    description:
    - Name of the zone in which the VM is in. If not set, default zone is used.
    type: str

state:
    choices:
    - present
    - absent
    - revert
    default: present
    description:
    - State of the snapshot.
    type: str

domain:
    description:
    - Domain the VM snapshot is related to.
    type: str

account:
    description:
    - Account the VM snapshot is related to.
    type: str

api_key:
    description:
    - API key of the CloudStack API.
    - If not given, the C(CLOUDSTACK_KEY) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

api_url:
    description:
    - URL of the CloudStack API e.g. https://cloud.example.com/client/api.
    - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

project:
    description:
    - Name of the project the VM is assigned to.
    type: str

api_region:
    default: cloudstack
    description:
    - Name of the ini section in the C(cloustack.ini) file.
    - If not given, the C(CLOUDSTACK_REGION) env variable is considered.
    type: str

api_secret:
    description:
    - Secret key of the CloudStack API.
    - If not set, the C(CLOUDSTACK_SECRET) env variable is considered.
    - As the last option, the value is taken from the ini config file, also see the notes.
    type: str

poll_async:
    default: true
    description:
    - Poll async jobs until job has finished.
    type: bool

api_timeout:
    description:
    - HTTP timeout in seconds.
    - If not given, the C(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.
    type: int

description:
    description:
    - Description of the snapshot.
    type: str

api_http_method:
    choices:
    - get
    - post
    description:
    - HTTP method used to query the API endpoint.
    - If not given, the C(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 C(get) if not specified.
    type: str

snapshot_memory:
    default: false
    description:
    - Snapshot memory if set to true.
    type: bool

Outputs

account:
  description: Account the vm snapshot is related to.
  returned: success
  sample: example account
  type: str
created:
  description: date of the snapshot.
  returned: success
  sample: 2015-03-29T14:57:06+0200
  type: str
current:
  description: true if the snapshot is current
  returned: success
  sample: true
  type: bool
description:
  description: description of vm snapshot
  returned: success
  sample: snapshot brought to you by Ansible
  type: str
display_name:
  description: Display name of the snapshot.
  returned: success
  sample: snapshot before update
  type: str
domain:
  description: Domain the vm snapshot is related to.
  returned: success
  sample: example domain
  type: str
id:
  description: UUID of the snapshot.
  returned: success
  sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f
  type: str
name:
  description: Name of the snapshot.
  returned: success
  sample: snapshot before update
  type: str
project:
  description: Name of project the vm snapshot is related to.
  returned: success
  sample: Production
  type: str
state:
  description: state of the vm snapshot
  returned: success
  sample: Allocated
  type: str
type:
  description: type of vm snapshot
  returned: success
  sample: DiskAndMemory
  type: str