oracle.oci.oci_mysql_backup – Manage a Backup resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.11.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_mysql_backup.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete a Backup resource in Oracle Cloud Infrastructure

  • For state=present, create a backup of a DB System.

  • This resource has the following action operations in the oracle.oci.oci_mysql_backup_actions module: change_compartment.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
backup_id
string
The OCID of the Backup
Required for update using state=present when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.
Required for delete using state=absent when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: id
backup_type
string
    Choices:
  • FULL
  • INCREMENTAL
The type of backup.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
compartment_id
string
The compartment OCID.
Required for create using state=present.
Required for update when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
Required for delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
db_system_id
string
The OCID of the DB System the Backup is associated with.
Required for create using state=present.
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`
This parameter is updatable.
description
string
A user-supplied description for the backup.
This parameter is updatable.
display_name
string
A user-supplied display name for the backup.
Required for create, update, delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
This parameter is updatable when OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: name
force_create
boolean
    Choices:
  • no ←
  • yes
Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by.
freeform_tags
dictionary
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`
This parameter is updatable.
key_by
list / elements=string
The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
retention_in_days
integer
Number of days to retain this backup.
This parameter is updatable.
state
string
    Choices:
  • present ←
  • absent
The state of the Backup.
Use state=present to create or update a Backup.
Use state=absent to delete a Backup.
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
wait
boolean
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout
integer
Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout.

Examples

- name: Create backup
  oci_mysql_backup:
    # required
    db_system_id: "ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    backup_type: FULL
    display_name: display_name_example
    description: description_example
    retention_in_days: 56
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update backup
  oci_mysql_backup:
    # required
    backup_id: "ocid1.backup.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    display_name: display_name_example
    description: description_example
    retention_in_days: 56
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update backup using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_mysql_backup:
    # required
    display_name: display_name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    description: description_example
    retention_in_days: 56
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Delete backup
  oci_mysql_backup:
    # required
    backup_id: "ocid1.backup.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

- name: Delete backup using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_mysql_backup:
    # required
    display_name: display_name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

Return Values

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

Key Returned Description
backup
complex
on success
Details of the Backup resource acted upon by the current operation

Sample:
{'backup_size_in_gbs': 56, 'backup_type': 'FULL', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'creation_type': 'MANUAL', 'data_storage_size_in_gbs': 56, 'db_system_id': 'ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx', 'db_system_snapshot': {'admin_username': 'admin_username_example', 'availability_domain': 'Uocm:PHX-AD-1', 'backup_policy': {'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'freeform_tags': {'Department': 'Finance'}, 'is_enabled': True, 'pitr_policy': {'is_enabled': True}, 'retention_in_days': 56, 'window_start_time': 'window_start_time_example'}, 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'configuration_id': 'ocid1.configuration.oc1..xxxxxxEXAMPLExxxxxx', 'crash_recovery': 'ENABLED', 'data_storage_size_in_gbs': 56, 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'deletion_policy': {'automatic_backup_retention': 'DELETE', 'final_backup': 'SKIP_FINAL_BACKUP', 'is_delete_protected': True}, 'description': 'description_example', 'display_name': 'display_name_example', 'endpoints': [{'hostname': 'hostname_example', 'ip_address': 'ip_address_example', 'modes': [], 'port': 56, 'port_x': 56, 'resource_id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'resource_type': 'DBSYSTEM', 'status': 'ACTIVE', 'status_details': 'status_details_example'}], 'fault_domain': 'FAULT-DOMAIN-1', 'freeform_tags': {'Department': 'Finance'}, 'hostname_label': 'hostname_label_example', 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'ip_address': 'ip_address_example', 'is_highly_available': True, 'maintenance': {'window_start_time': 'window_start_time_example'}, 'mysql_version': 'mysql_version_example', 'port': 56, 'port_x': 56, 'shape_name': 'shape_name_example', 'subnet_id': 'ocid1.subnet.oc1..xxxxxxEXAMPLExxxxxx'}, 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'description': 'description_example', 'display_name': 'display_name_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'lifecycle_details': 'lifecycle_details_example', 'lifecycle_state': 'CREATING', 'mysql_version': 'mysql_version_example', 'retention_in_days': 56, 'shape_name': 'shape_name_example', 'time_created': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00'}
 
backup_size_in_gbs
integer
on success
The size of the backup in base-2 (IEC) gibibytes. (GiB).

Sample:
56
 
backup_type
string
on success
The type of backup.

Sample:
FULL
 
compartment_id
string
on success
The OCID of the compartment.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
creation_type
string
on success
Indicates how the backup was created: manually, automatic, or by an Operator.

Sample:
MANUAL
 
data_storage_size_in_gbs
integer
on success
Initial size of the data volume in GiBs.

Sample:
56
 
db_system_id
string
on success
The OCID of the DB System the backup is associated with.

Sample:
ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx
 
db_system_snapshot
complex
on success

   
admin_username
string
on success
The username for the administrative user.

Sample:
admin_username_example
   
availability_domain
string
on success
The Availability Domain where the primary DB System should be located.

Sample:
Uocm:PHX-AD-1
   
backup_policy
complex
on success

     
defined_tags
dictionary
on success
Usage of predefined tag keys. These predefined keys are scoped to namespaces.
Tags defined here will be copied verbatim as tags on the Backup resource created by this BackupPolicy.
Example: `{"foo-namespace": {"bar-key": "value"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
     
freeform_tags
dictionary
on success
Simple key-value pair applied without any predefined name, type or scope. Exists for cross-compatibility only.
Tags defined here will be copied verbatim as tags on the Backup resource created by this BackupPolicy.
Example: `{"bar-key": "value"}`

Sample:
{'Department': 'Finance'}
     
is_enabled
boolean
on success
If automated backups are enabled or disabled.

Sample:
True
     
pitr_policy
complex
on success

       
is_enabled
boolean
on success
Specifies if PITR is enabled or disabled.

Sample:
True
     
retention_in_days
integer
on success
The number of days automated backups are retained.

Sample:
56
     
window_start_time
string
on success
The start of a 30-minute window of time in which daily, automated backups occur.
This should be in the format of the "Time" portion of an RFC3339-formatted timestamp. Any second or sub-second time data will be truncated to zero.
At some point in the window, the system may incur a brief service disruption as the backup is performed.
If not defined, a window is selected from the following Region-based time-spans: - eu-frankfurt-1: 20:00 - 04:00 UTC - us-ashburn-1: 03:00 - 11:00 UTC - uk-london-1: 06:00 - 14:00 UTC - ap-tokyo-1: 13:00 - 21:00 - us-phoenix-1: 06:00 - 14:00

Sample:
window_start_time_example
   
compartment_id
string
on success
The OCID of the compartment the DB System belongs in.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
   
configuration_id
string
on success
The OCID of the Configuration to be used for Instances in this DB System.

Sample:
ocid1.configuration.oc1..xxxxxxEXAMPLExxxxxx
   
crash_recovery
string
on success
Whether to run the DB System with InnoDB Redo Logs and the Double Write Buffer enabled or disabled, and whether to enable or disable syncing of the Binary Logs.

Sample:
ENABLED
   
data_storage_size_in_gbs
integer
on success
Initial size of the data volume in GiBs that will be created and attached.

Sample:
56
   
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
   
deletion_policy
complex
on success

     
automatic_backup_retention
string
on success
Specifies if any automatic backups created for a DB System should be retained or deleted when the DB System is deleted.

Sample:
DELETE
     
final_backup
string
on success
Specifies whether or not a backup is taken when the DB System is deleted. REQUIRE_FINAL_BACKUP: a backup is taken if the DB System is deleted. SKIP_FINAL_BACKUP: a backup is not taken if the DB System is deleted.

Sample:
SKIP_FINAL_BACKUP
     
is_delete_protected
boolean
on success
Specifies whether the DB System can be deleted. Set to true to prevent deletion, false (default) to allow.

Sample:
True
   
description
string
on success
User-provided data about the DB System.

Sample:
description_example
   
display_name
string
on success
The user-friendly name for the DB System. It does not have to be unique.

Sample:
display_name_example
   
endpoints
complex
on success
The network endpoints available for this DB System.

     
hostname
string
on success
The network address of the DB System.

Sample:
hostname_example
     
ip_address
string
on success
The IP address the DB System is configured to listen on.

Sample:
ip_address_example
     
modes
list / elements=string
on success
The access modes from the client that this endpoint supports.

     
port
integer
on success
The port the MySQL instance listens on.

Sample:
56
     
port_x
integer
on success
The network port where to connect to use this endpoint using the X protocol.

Sample:
56
     
resource_id
string
on success
The OCID of the resource that this endpoint is attached to.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
     
resource_type
string
on success
The type of endpoint that clients and connectors can connect to.

Sample:
DBSYSTEM
     
status
string
on success
The state of the endpoints, as far as it can seen from the DB System. There may be some inconsistency with the actual state of the MySQL service.

Sample:
ACTIVE
     
status_details
string
on success
Additional information about the current endpoint status.

Sample:
status_details_example
   
fault_domain
string
on success
The name of the Fault Domain the DB System is located in.

Sample:
FAULT-DOMAIN-1
   
freeform_tags
dictionary
on success
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`

Sample:
{'Department': 'Finance'}
   
hostname_label
string
on success
The hostname for the primary endpoint of the DB System. Used for DNS. The value is the hostname portion of the primary private IP's fully qualified domain name (FQDN) (for example, "dbsystem-1" in FQDN "dbsystem-1.subnet123.vcn1.oraclevcn.com"). Must be unique across all VNICs in the subnet and comply with RFC 952 and RFC 1123.

Sample:
hostname_label_example
   
id
string
on success
The OCID of the DB System.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
   
ip_address
string
on success
The IP address the DB System is configured to listen on. A private IP address of the primary endpoint of the DB System. Must be an available IP address within the subnet's CIDR. This will be a "dotted-quad" style IPv4 address.

Sample:
ip_address_example
   
is_highly_available
boolean
on success
Specifies if the DB System is highly available.

Sample:
True
   
maintenance
complex
on success

     
window_start_time
string
on success
The start time of the maintenance window.
This string is of the format: "{day-of-week} {time-of-day}".
"{day-of-week}" is a case-insensitive string like "mon", "tue", &c.
"{time-of-day}" is the "Time" portion of an RFC3339-formatted timestamp. Any second or sub-second time data will be truncated to zero.
If you set the read replica maintenance window to "" or if not specified, the read replica is set same as the DB system maintenance window.

Sample:
window_start_time_example
   
mysql_version
string
on success
Name of the MySQL Version in use for the DB System.

Sample:
mysql_version_example
   
port
integer
on success
The port for primary endpoint of the DB System to listen on.

Sample:
56
   
port_x
integer
on success
The network port on which X Plugin listens for TCP/IP connections. This is the X Plugin equivalent of port.

Sample:
56
   
shape_name
string
on success
The shape of the primary instances of the DB System. The shape determines resources allocated to a DB System - CPU cores and memory for VM shapes; CPU cores, memory and storage for non-VM (or bare metal) shapes. To get a list of shapes, use (the ListShapes operation.

Sample:
shape_name_example
   
subnet_id
string
on success
The OCID of the subnet the DB System is associated with.

Sample:
ocid1.subnet.oc1..xxxxxxEXAMPLExxxxxx
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
description
string
on success
A user-supplied description for the backup.

Sample:
description_example
 
display_name
string
on success
A user-supplied display name for the backup.

Sample:
display_name_example
 
freeform_tags
dictionary
on success
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
OCID of the backup itself

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
lifecycle_details
string
on success
Additional information about the current lifecycleState.

Sample:
lifecycle_details_example
 
lifecycle_state
string
on success
The state of the backup.

Sample:
CREATING
 
mysql_version
string
on success
The MySQL server version of the DB System used for backup.

Sample:
mysql_version_example
 
retention_in_days
integer
on success
Number of days to retain this backup.

Sample:
56
 
shape_name
string
on success
The shape of the DB System used for backup.

Sample:
shape_name_example
 
time_created
string
on success
The time the backup record was created.

Sample:
2013-10-20T19:20:30+01:00
 
time_updated
string
on success
The time at which the backup was updated.

Sample:
2013-10-20T19:20:30+01:00


Authors

  • Oracle (@oracle)