community / community.digitalocean / 1.26.0 / module / digital_ocean_snapshot Create and delete DigitalOcean snapshots | "added in version" 1.7.0 of community.digitalocean" Authors: Mark Mercado (@mamercad)community.digitalocean.digital_ocean_snapshot (1.26.0) — module
Install with ansible-galaxy collection install community.digitalocean:==1.26.0
collections: - name: community.digitalocean version: 1.26.0
This module can be used to create and delete DigitalOcean Droplet and volume snapshots.
- name: Snapshot a Droplet community.digitalocean.digital_ocean_snapshot: state: present snapshot_type: droplet droplet_id: 250329179 register: result
- name: Delete a Droplet snapshot community.digitalocean.digital_ocean_snapshot: state: absent snapshot_type: droplet snapshot_id: 85905825 register: result
- name: Snapshot a Volume community.digitalocean.digital_ocean_snapshot: state: present snapshot_type: volume snapshot_name: mysnapshot1 volume_id: 9db5e329-cc68-11eb-b027-0a58ac144f91
- name: Delete a Volume snapshot community.digitalocean.digital_ocean_snapshot: state: absent snapshot_type: volume snapshot_id: a902cdba-cc68-11eb-a701-0a58ac145708
wait: default: true description: - Wait for the snapshot to be created before returning. type: bool state: choices: - present - absent default: present description: - Whether the snapshot should be present (created) or absent (deleted). type: str baseurl: default: https://api.digitalocean.com/v2 description: - DigitalOcean API base url. type: str timeout: default: 30 description: - The timeout in seconds used for polling DigitalOcean's API. type: int volume_id: description: - Volume ID to snapshot. type: str droplet_id: description: - Droplet ID to snapshot. type: str oauth_token: aliases: - api_token description: - DigitalOcean OAuth token. - There are several other environment variables which can be used to provide this value. - i.e., - C(DO_API_TOKEN), C(DO_API_KEY), C(DO_OAUTH_TOKEN) and C(OAUTH_TOKEN). type: str snapshot_id: description: - Snapshot ID to delete. type: str wait_timeout: default: 120 description: - How long before wait gives up, in seconds, when creating a snapshot. type: int snapshot_name: description: - Name of the snapshot to create. type: str snapshot_tags: default: [] description: - List of tags to apply to the volume snapshot. - Only applies to volume snapshots (not Droplets). elements: str type: list snapshot_type: choices: - droplet - volume default: droplet description: - Specifies the type of snapshot information to be create or delete. - If set to C(droplet), then a Droplet snapshot is created. - If set to C(volume), then a volume snapshot is created. type: str validate_certs: default: true description: - If set to C(no), the SSL certificates will not be validated. - This should only set to C(no) used on personally controlled sites using self-signed certificates. type: bool
data: description: Snapshot creation or deletion action. returned: success sample: - completed_at: '2021-06-14T12:36:00Z' id: 1229119156 region: available: true features: - backups - ipv6 - metadata - install_agent - storage - image_transfer name: New York 1 sizes: - s-1vcpu-1gb - s-1vcpu-1gb-amd - s-1vcpu-1gb-intel - <snip> slug: nyc1 region_slug: nyc1 resource_id: 250445117 resource_type: droplet started_at: '2021-06-14T12:35:25Z' status: completed type: snapshot - created_at: '2021-06-14T12:55:10Z' id: c06d4a86-cd0f-11eb-b13c-0a58ac145472 min_disk_size: 1 name: my-snapshot-1 regions: - nbg1 resource_id: f0adea7e-cd0d-11eb-b027-0a58ac144f91 resource_type: volume size_gigabytes: 0 tags: - tag1 - tag2 type: dict