oracle.oci.oci_psql_db_system_actions – Perform actions on a DbSystem resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 5.0.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_psql_db_system_actions.

New in version 2.9.0: of oracle.oci

Synopsis

  • Perform actions on a DbSystem resource in Oracle Cloud Infrastructure

  • For action=change_compartment, moves a database system from one compartment to another. When provided, If-Match is checked against ETag values of the resource.

  • For action=failover, runs a failover operation. Optionally, specify the desired AD for regions with three ADs.

  • For action=reset_master_user_password, resets the database system’s master password.

  • For action=restart_db_instance_in, restarts the running database instance node.

  • For action=restore, restore the database system.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
action
string / required
    Choices:
  • change_compartment
  • failover
  • reset_master_user_password
  • restart_db_instance_in
  • restore
The action to perform on the DbSystem.
ad
string
The preferred AD for regions with three availability domains. This parameter is optional. If not set, the AD will be chosen based on availability.
Applicable only for action=failoveraction=restore.
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
  • security_token
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 database system backup.
Required for action=restore.
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 OCID of the compartment into which the database system should be moved.
Required for action=change_compartment.
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_instance_id
string
The OCID of the database instance node. This parameter is optional. If not set, an existing database instance node will be chosen based on availability.
Required for action=restart_db_instance_in.
db_system_id
string / required
A unique identifier for the database system.

aliases: id
password_details
dictionary
Required for action=reset_master_user_password.
password
string
The database system password.
Required when password_type is 'PLAIN_TEXT'
password_type
string / required
    Choices:
  • PLAIN_TEXT
  • VAULT_SECRET
The password type.
secret_id
string
The OCID of the secret where the password is stored.
Required when password_type is 'VAULT_SECRET'
secret_version
string
The secret version of the stored password.
Required when password_type is 'VAULT_SECRET'
realm_specific_endpoint_template_enabled
boolean
    Choices:
  • no
  • yes
Enable/Disable realm specific endpoint template for service client. By Default, realm specific endpoint template is disabled. If not set, then the value of the OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED variable, if any, is used.
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.
restart_type
string
    Choices:
  • NORMAL
  • NODE_REBOOT
The restart type for the database instance.
Required for action=restart_db_instance_in.
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: Perform action change_compartment on db_system
  oci_psql_db_system_actions:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    db_system_id: "ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx"
    action: change_compartment

- name: Perform action failover on db_system
  oci_psql_db_system_actions:
    # required
    db_system_id: "ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx"
    action: failover

    # optional
    db_instance_id: "ocid1.dbinstance.oc1..xxxxxxEXAMPLExxxxxx"
    ad: Uocm:PHX-AD-1

- name: Perform action reset_master_user_password on db_system
  oci_psql_db_system_actions:
    # required
    password_details:
      # required
      password: example-password
      password_type: PLAIN_TEXT
    db_system_id: "ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx"
    action: reset_master_user_password

- name: Perform action restart_db_instance_in on db_system
  oci_psql_db_system_actions:
    # required
    db_instance_id: "ocid1.dbinstance.oc1..xxxxxxEXAMPLExxxxxx"
    restart_type: NORMAL
    db_system_id: "ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx"
    action: restart_db_instance_in

- name: Perform action restore on db_system
  oci_psql_db_system_actions:
    # required
    db_system_id: "ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx"
    backup_id: "ocid1.backup.oc1..xxxxxxEXAMPLExxxxxx"
    action: restore

    # optional
    ad: Uocm:PHX-AD-1

Return Values

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

Key Returned Description
db_system
complex
on success
Details of the DbSystem resource acted upon by the current operation

Sample:
{'admin_username': 'admin_username_example', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'config_id': 'ocid1.config.oc1..xxxxxxEXAMPLExxxxxx', 'db_version': 'db_version_example', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'description': 'description_example', 'display_name': 'display_name_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'instance_count': 56, 'instance_memory_size_in_gbs': 56, 'instance_ocpu_count': 56, 'instances': [{'availability_domain': 'Uocm:PHX-AD-1', 'description': 'description_example', 'display_name': 'display_name_example', 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'lifecycle_details': 'lifecycle_details_example', 'lifecycle_state': 'CREATING', 'time_created': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00'}], 'lifecycle_details': 'lifecycle_details_example', 'lifecycle_state': 'CREATING', 'management_policy': {'backup_policy': {'backup_start': 'backup_start_example', 'days_of_the_month': [], 'days_of_the_week': [], 'kind': 'DAILY', 'retention_days': 56}, 'maintenance_window_start': 'maintenance_window_start_example'}, 'network_details': {'nsg_ids': [], 'primary_db_endpoint_private_ip': 'primary_db_endpoint_private_ip_example', 'subnet_id': 'ocid1.subnet.oc1..xxxxxxEXAMPLExxxxxx'}, 'shape': 'shape_example', 'source': {'backup_id': 'ocid1.backup.oc1..xxxxxxEXAMPLExxxxxx', 'is_having_restore_config_overrides': True, 'source_type': 'BACKUP'}, 'storage_details': {'availability_domain': 'Uocm:PHX-AD-1', 'iops': 56, 'is_regionally_durable': True, 'system_type': 'OCI_OPTIMIZED_STORAGE'}, 'system_tags': {}, 'system_type': 'OCI_OPTIMIZED_STORAGE', 'time_created': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00'}
 
admin_username
string
on success
The database system administrator username.

Sample:
admin_username_example
 
compartment_id
string
on success
The OCID of the compartment that contains the database system.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
config_id
string
on success
The OCID of the configuration associated with the database system.

Sample:
ocid1.config.oc1..xxxxxxEXAMPLExxxxxx
 
db_version
string
on success
The major and minor versions of the database system software.

Sample:
db_version_example
 
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 description of the database system.

Sample:
description_example
 
display_name
string
on success
A user-friendly display name for the database system. Avoid entering confidential information.

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
A unique identifier for the database system. Immutable on creation.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
instance_count
integer
on success
Count of instances, or nodes, in the database system.

Sample:
56
 
instance_memory_size_in_gbs
integer
on success
The total amount of memory available to each database instance node, in gigabytes.

Sample:
56
 
instance_ocpu_count
integer
on success
The total number of OCPUs available to each database instance node.

Sample:
56
 
instances
complex
on success
The list of instances, or nodes, in the database system.

   
availability_domain
string
on success
The availability domain in which the database instance node is located.

Sample:
Uocm:PHX-AD-1
   
description
string
on success
Description of the database instance node.

Sample:
description_example
   
display_name
string
on success
A user-friendly display name for the database instance node. Avoid entering confidential information.

Sample:
display_name_example
   
id
string
on success
A unique identifier for the database instance node. Immutable on creation.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
   
lifecycle_details
string
on success
A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state.

Sample:
lifecycle_details_example
   
lifecycle_state
string
on success
The current state of the database instance node.

Sample:
CREATING
   
time_created
string
on success
The date and time that the database instance node was created, expressed in RFC 3339 timestamp format.
Example: `2016-08-25T21:10:29.600Z`

Sample:
2013-10-20T19:20:30+01:00
   
time_updated
string
on success
The date and time that the database instance node was updated, expressed in RFC 3339 timestamp format.
Example: `2016-08-25T21:10:29.600Z`

Sample:
2013-10-20T19:20:30+01:00
 
lifecycle_details
string
on success
A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in Failed state.

Sample:
lifecycle_details_example
 
lifecycle_state
string
on success
The current state of the database system.

Sample:
CREATING
 
management_policy
complex
on success

   
backup_policy
complex
on success

     
backup_start
string
on success
Hour of the day when the backup starts.

Sample:
backup_start_example
     
days_of_the_month
list / elements=string
on success
Day of the month when the backup should start. To ensure that the backup runs monthly, the latest day of the month that you can use to schedule a backup is the the 28th day.

     
days_of_the_week
list / elements=string
on success
The day of the week that the backup starts.

     
kind
string
on success
The kind of backup policy.

Sample:
DAILY
     
retention_days
integer
on success
How many days the data should be stored after the database system deletion.

Sample:
56
   
maintenance_window_start
string
on success
The start of the maintenance window.

Sample:
maintenance_window_start_example
 
network_details
complex
on success

   
nsg_ids
list / elements=string
on success
List of customer Network Security Group OCIDs associated with the database system.

   
primary_db_endpoint_private_ip
string
on success
Private IP in customer subnet. The value is optional. If the IP is not provided, the IP will be chosen from the available IP addresses from the specified subnet.

Sample:
primary_db_endpoint_private_ip_example
   
subnet_id
string
on success
The OCID of the customer subnet associated with the database system.

Sample:
ocid1.subnet.oc1..xxxxxxEXAMPLExxxxxx
 
shape
string
on success
The name of the shape for the database instance. Example: `VM.Standard.E4.Flex`

Sample:
shape_example
 
source
complex
on success

   
backup_id
string
on success
The OCID of the database system backup.

Sample:
ocid1.backup.oc1..xxxxxxEXAMPLExxxxxx
   
is_having_restore_config_overrides
boolean
on success
Deprecated. Don't use.

Sample:
True
   
source_type
string
on success
The source descriminator.

Sample:
BACKUP
 
storage_details
complex
on success

   
availability_domain
string
on success
Specifies the availability domain of AD-local storage. If `isRegionallyDurable` is set to true, `availabilityDomain` should not be specified. If `isRegionallyDurable` is set to false, `availabilityDomain` must be specified.

Sample:
Uocm:PHX-AD-1
   
iops
integer
on success
Guaranteed input/output storage requests per second (IOPS) available to the database system.

Sample:
56
   
is_regionally_durable
boolean
on success
Specifies if the block volume used for the database system is regional or AD-local. If not specified, it will be set to false. If `isRegionallyDurable` is set to true, `availabilityDomain` should not be specified. If `isRegionallyDurable` is set to false, `availabilityDomain` must be specified.

Sample:
True
   
system_type
string
on success
Type of the database system.

Sample:
OCI_OPTIMIZED_STORAGE
 
system_tags
dictionary
on success
System tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"orcl-cloud": {"free-tier-retained": "true"}}`

 
system_type
string
on success
Type of the database system.

Sample:
OCI_OPTIMIZED_STORAGE
 
time_created
string
on success
The date and time that the database system was created, expressed in RFC 3339 timestamp format.
Example: `2016-08-25T21:10:29.600Z`

Sample:
2013-10-20T19:20:30+01:00
 
time_updated
string
on success
The date and time that the database system was updated, expressed in RFC 3339 timestamp format.
Example: `2016-08-25T21:10:29.600Z`

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


Authors

  • Oracle (@oracle)