mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
496218b6e6
* Scaleway Database Backup : Create new module * Add changelog * Fix typo * Remove module duplicate * Fix typo Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> * Remove changelog * Improve doc * Improve documentation * Improve parameters checking * Fix blank space * Change result name (data to metadata) See https://github.com/ansible-collections/community.general/pull/741#discussion_r468537460 * Fix doc typo * Update plugins/modules/cloud/scaleway/scaleway_database_backup.py Co-authored-by: Felix Fontein <felix@fontein.de> * States explanations03f58894ff (r470845287)
* Fix documentation typo Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru> Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit8a16b51202
) Co-authored-by: Guillaume RODRIGUEZ <guiguidu31300@gmail.com>
228 lines
5.9 KiB
YAML
228 lines
5.9 KiB
YAML
- name: Create a backup (Check)
|
|
check_mode: yes
|
|
scaleway_database_backup:
|
|
name: '{{ scaleway_name }}'
|
|
state: present
|
|
region: '{{ scaleway_region }}'
|
|
database_name: '{{ scaleway_database_name }}'
|
|
instance_id: '{{ scaleway_instance_id }}'
|
|
|
|
register: backup_creation_check_task
|
|
|
|
- debug: var=backup_creation_check_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_creation_check_task is success
|
|
- backup_creation_check_task is changed
|
|
|
|
- name: Create a backup
|
|
scaleway_database_backup:
|
|
name: '{{ scaleway_name }}'
|
|
state: present
|
|
region: '{{ scaleway_region }}'
|
|
database_name: '{{ scaleway_database_name }}'
|
|
instance_id: '{{ scaleway_instance_id }}'
|
|
wait: true
|
|
|
|
register: backup_creation_task
|
|
|
|
- debug: var=backup_creation_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_creation_task is success
|
|
- backup_creation_task is changed
|
|
|
|
- name: Create a backup (Confirmation)
|
|
scaleway_database_backup:
|
|
name: '{{ scaleway_name }}'
|
|
state: present
|
|
region: '{{ scaleway_region }}'
|
|
database_name: '{{ scaleway_database_name }}'
|
|
instance_id: '{{ scaleway_instance_id }}'
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
|
|
register: backup_creation_confirmation_task
|
|
|
|
- debug: var=backup_creation_confirmation_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_creation_confirmation_task is success
|
|
- backup_creation_confirmation_task is not changed
|
|
|
|
- name: Patch backup name (Check)
|
|
check_mode: yes
|
|
scaleway_database_backup:
|
|
name: '{{ scaleway_name }}-changed'
|
|
state: present
|
|
region: '{{ scaleway_region }}'
|
|
database_name: '{{ scaleway_database_name }}'
|
|
instance_id: '{{ scaleway_instance_id }}'
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
register: backup_patching_check_task
|
|
|
|
- debug: var=backup_patching_check_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_patching_check_task is success
|
|
- backup_patching_check_task is changed
|
|
|
|
- name: Patch backup name
|
|
scaleway_database_backup:
|
|
name: '{{ scaleway_name }}-changed'
|
|
state: present
|
|
region: '{{ scaleway_region }}'
|
|
database_name: '{{ scaleway_database_name }}'
|
|
instance_id: '{{ scaleway_instance_id }}'
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
register: backup_patching_task
|
|
|
|
- debug: var=backup_patching_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_patching_task is success
|
|
- backup_patching_task is changed
|
|
|
|
- name: Patch backup name (Confirmation)
|
|
scaleway_database_backup:
|
|
name: '{{ scaleway_name }}-changed'
|
|
state: present
|
|
region: '{{ scaleway_region }}'
|
|
database_name: '{{ scaleway_database_name }}'
|
|
instance_id: '{{ scaleway_instance_id }}'
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
register: backup_patching_confirmation_task
|
|
|
|
- debug: var=backup_patching_confirmation_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_patching_confirmation_task is success
|
|
- backup_patching_confirmation_task is not changed
|
|
|
|
- name: Export backup (Check)
|
|
check_mode: yes
|
|
scaleway_database_backup:
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
state: exported
|
|
region: '{{ scaleway_region }}'
|
|
register: backup_export_check_task
|
|
|
|
- debug: var=backup_export_check_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_export_check_task is success
|
|
- backup_export_check_task is changed
|
|
|
|
- name: Export backup
|
|
scaleway_database_backup:
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
state: exported
|
|
region: '{{ scaleway_region }}'
|
|
wait: true
|
|
register: backup_export_task
|
|
|
|
- debug: var=backup_export_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_export_task is success
|
|
- backup_export_task is changed
|
|
- backup_export_task.metadata.download_url != ""
|
|
|
|
- name: Export backup (Confirmation)
|
|
scaleway_database_backup:
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
state: exported
|
|
region: '{{ scaleway_region }}'
|
|
register: backup_export_confirmation_task
|
|
|
|
- debug: var=backup_export_confirmation_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_export_confirmation_task is success
|
|
- backup_export_confirmation_task is not changed
|
|
- backup_export_confirmation_task.metadata.download_url != ""
|
|
|
|
- name: Restore backup (Check)
|
|
check_mode: yes
|
|
scaleway_database_backup:
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
state: restored
|
|
region: '{{ scaleway_region }}'
|
|
database_name: '{{ scaleway_database_name }}'
|
|
instance_id: '{{ scaleway_instance_id }}'
|
|
register: backup_restore_check_task
|
|
|
|
- debug: var=backup_restore_check_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_restore_check_task is success
|
|
- backup_restore_check_task is changed
|
|
|
|
- name: Restore backup
|
|
scaleway_database_backup:
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
state: restored
|
|
region: '{{ scaleway_region }}'
|
|
database_name: '{{ scaleway_database_name }}'
|
|
instance_id: '{{ scaleway_instance_id }}'
|
|
wait: true
|
|
register: backup_restore_task
|
|
|
|
- debug: var=backup_restore_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_restore_task is success
|
|
- backup_restore_task is changed
|
|
|
|
- name: Delete backup (Check)
|
|
check_mode: yes
|
|
scaleway_database_backup:
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
state: absent
|
|
region: '{{ scaleway_region }}'
|
|
register: backup_delete_check_task
|
|
|
|
- debug: var=backup_delete_check_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_delete_check_task is success
|
|
- backup_delete_check_task is changed
|
|
|
|
- name: Delete backup
|
|
scaleway_database_backup:
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
state: absent
|
|
region: '{{ scaleway_region }}'
|
|
register: backup_delete_task
|
|
|
|
- debug: var=backup_delete_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_delete_task is success
|
|
- backup_delete_task is changed
|
|
|
|
- name: Delete backup (Confirmation)
|
|
scaleway_database_backup:
|
|
id: '{{ backup_creation_task.metadata.id }}'
|
|
state: absent
|
|
region: '{{ scaleway_region }}'
|
|
register: backup_delete_confirmation_task
|
|
|
|
- debug: var=backup_delete_confirmation_task
|
|
|
|
- assert:
|
|
that:
|
|
- backup_delete_confirmation_task is success
|
|
- backup_delete_confirmation_task is not changed
|