community.general.scaleway_database_backup – Scaleway database backups management module

Note

This plugin is part of the community.general collection (version 2.2.0).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.scaleway_database_backup.

New in version 1.2.0: of community.general

Synopsis

Parameters

Parameter Choices/Defaults Comments
api_timeout
integer
Default:
30
HTTP timeout to Scaleway API in seconds.

aliases: timeout
api_token
string / required
Scaleway OAuth token.

aliases: oauth_token
api_url
string
Default:
"https://api.scaleway.com"
Scaleway API URL.

aliases: base_url
database_name
string
Name used to identify the database.
Required for present and restored states.
Ignored when state=absent or state=exported.
expires_at
string
Expiration datetime of the database backup (ISO 8601 format).
Ignored when state=absent, state=exported or state=restored.
id
string
UUID used to identify the database backup.
Required for absent, exported and restored states.
instance_id
string
UUID of the instance associated to the database backup.
Required for present and restored states.
Ignored when state=absent or state=exported.
name
string
Name used to identify the database backup.
Required for present state.
Ignored when state=absent, state=exported or state=restored.
query_parameters
dictionary
Default:
{}
List of parameters passed to the query string.
region
string / required
    Choices:
  • fr-par
  • nl-ams
  • pl-waw
Scaleway region to use (for example fr-par).
state
string
    Choices:
  • present ←
  • absent
  • exported
  • restored
Indicate desired state of the database backup.
present creates a backup.
absent deletes the backup.
exported creates a download link for the backup.
restored restores the backup to a new database.
validate_certs
boolean
    Choices:
  • no
  • yes ←
Validate SSL certs of the Scaleway API.
wait
boolean
    Choices:
  • no ←
  • yes
Wait for the instance to reach its desired state before returning.
wait_sleep_time
integer
Default:
3
Time to wait before every attempt to check the state of the backup.
wait_timeout
integer
Default:
300
Time to wait for the backup to reach the expected state.

Notes

Note

  • Also see the API documentation on https://developer.scaleway.com/

  • If api_token is not set within the module, the following environment variables can be used in decreasing order of precedence SCW_TOKEN, SCW_API_KEY, SCW_OAUTH_TOKEN or SCW_API_TOKEN.

  • If one wants to use a different api_url one can also set the SCW_API_URL environment variable.

Examples

- name: Create a backup
  community.general.scaleway_database_backup:
      name: 'my_backup'
      state: present
      region: 'fr-par'
      database_name: 'my-database'
      instance_id: '50968a80-2909-4e5c-b1af-a2e19860dddb'

- name: Export a backup
  community.general.scaleway_database_backup:
      id: '6ef1125a-037e-494f-a911-6d9c49a51691'
      state: exported
      region: 'fr-par'

- name: Restore a backup
  community.general.scaleway_database_backup:
      id: '6ef1125a-037e-494f-a911-6d9c49a51691'
      state: restored
      region: 'fr-par'
      database_name: 'my-new-database'
      instance_id: '50968a80-2909-4e5c-b1af-a2e19860dddb'

- name: Remove a backup
  community.general.scaleway_database_backup:
      id: '6ef1125a-037e-494f-a911-6d9c49a51691'
      state: absent
      region: 'fr-par'

Return Values

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

Key Returned Description
metadata
dictionary
when state=present, state=exported or state=restored
Backup metadata.

Sample:
{'metadata': {'created_at': '2020-08-06T12:42:05.631049Z', 'database_name': 'my-database', 'download_url': None, 'download_url_expires_at': None, 'expires_at': None, 'id': 'a15297bd-0c4a-4b4f-8fbb-b36a35b7eb07', 'instance_id': '617be32e-6497-4ed7-b4c7-0ee5a81edf49', 'instance_name': 'my-instance', 'name': 'backup_name', 'region': 'fr-par', 'size': 600000, 'status': 'ready', 'updated_at': '2020-08-06T12:42:10.581649Z'}}


Authors

  • Guillaume Rodriguez (@guillaume_ro_fr)