oracle.oci.oci_psql_db_system – Manage a DbSystem resource in Oracle Cloud Infrastructure

Note

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

New in version 2.9.0: of oracle.oci

Synopsis

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

  • For state=present, creates a new database system.

  • This resource has the following action operations in the oracle.oci.oci_psql_db_system_actions module: change_compartment, failover, reset_master_user_password, restart_db_instance_in, restore.

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
  • 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.
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 that contains the database system.
Required for create using state=present.
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_id
string
The OCID of the configuration associated with the database system.
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.
credentials
dictionary
password_details
dictionary / required
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'
username
string / required
The database system administrator username.
db_configuration_params
dictionary
This parameter is updatable.
apply_config
string
    Choices:
  • RESTART
  • RELOAD
Whether a configuration update requires a restart of the database instance or a reload of the configuration. Some configuration changes require a restart of database instances to be applied.
This parameter is updatable.
config_id
string / required
The OCID of the configuration.
This parameter is updatable.
db_system_id
string
A unique identifier for the database system.
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
db_version
string
Version of database system software.
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-provided description of a database system.
This parameter is updatable.
display_name
string
A user-friendly display name for the database system. Avoid entering confidential information.
Required for create using state=present.
Required for 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.
instance_count
integer
Count of database instances nodes to be created in the database system.
instance_memory_size_in_gbs
integer
The total amount of memory available to each database instance node, in gigabytes.
instance_ocpu_count
integer
The total number of OCPUs available to each database instance node.
instances_details
list / elements=dictionary
Details of database instances nodes to be created. This parameter is optional. If specified, its size must match `instanceCount`.
description
string
A user-provided description of the database instance node.
display_name
string
Display name of the database instance node. Avoid entering confidential information.

aliases: name
private_ip
string
Private IP in customer subnet that will be assigned to the database instance node. This value is optional. If the IP is not provided, the IP will be chosen from the available IP addresses in the specified subnet.
items
list / elements=dictionary
List of patch instructions.
_from
string
The selection that is to be moved, with the same format and semantics as `selection`.
Required when operation is 'MOVE'
operation
string / required
    Choices:
  • MOVE
  • REMOVE
  • REPLACE
  • INSERT
  • REQUIRE
  • MERGE
  • PROHIBIT
position
string
    Choices:
  • AT
  • BEFORE
  • AFTER
Where to insert the value in an array, relative to the first item in the selection. If there is no such item, then "BEFORE" specifies insertion at the first position in an array and "AFTER" specifies insertion at the last position. If the first item in the selection is not the child of an array, then this field has no effect.
Applicable when operation is one of ['MOVE', 'INSERT']
selected_item
string
A selection to be evaluated against the array for identifying a particular reference item within it, with the same format and semantics as `selection`.
Applicable when operation is 'INSERT'
selection
string / required
The set of values to which the operation applies as a JMESPath expression for evaluation against the context resource. An operation fails if the selection yields an exception, except as otherwise specified. Note that comparisons involving non-primitive values (objects or arrays) are not supported and will always evaluate to false.
value
dictionary
A value to be added into the target.
Applicable when operation is one of ['MERGE', 'PROHIBIT', 'REQUIRE']
Required when operation is one of ['INSERT', 'REPLACE']
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.
management_policy
dictionary
This parameter is updatable.
backup_policy
dictionary
backup_start
string
Hour of the day when the backup starts.
Required when kind is one of ['WEEKLY', 'DAILY', 'MONTHLY']
days_of_the_month
list / elements=integer
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.
Required when kind is 'MONTHLY'
days_of_the_week
list / elements=string
    Choices:
  • SUNDAY
  • MONDAY
  • TUESDAY
  • WEDNESDAY
  • THURSDAY
  • FRIDAY
  • SATURDAY
The day of the week that the backup starts.
Required when kind is 'WEEKLY'
kind
string / required
    Choices:
  • DAILY
  • WEEKLY
  • NONE
  • MONTHLY
The kind of backup policy.
retention_days
integer
How many days the data should be stored after the database system deletion.
maintenance_window_start
string
The start of the maintenance window.
network_details
dictionary
Required for create using state=present.
nsg_ids
list / elements=string
List of customer Network Security Group OCIDs associated with the database system.
primary_db_endpoint_private_ip
string
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.
subnet_id
string / required
The OCID of the customer subnet associated with the database system.
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.
shape
string
The name of the shape for the database instance node. Use the /shapes API for accepted shapes. Example: `VM.Standard.E4.Flex`
Required for create using state=present.
source
dictionary
backup_id
string
The OCID of the database system backup.
Required when source_type is 'BACKUP'
is_having_restore_config_overrides
boolean
    Choices:
  • no
  • yes
Deprecated. Don't use.
Applicable when source_type is 'BACKUP'
source_type
string / required
    Choices:
  • BACKUP
  • NONE
The source descriminator.
state
string
    Choices:
  • present ←
  • absent
The state of the DbSystem.
Use state=present to create or update a DbSystem.
Use state=absent to delete a DbSystem.
storage_details
dictionary
Required for create using state=present.
This parameter is updatable.
availability_domain
string
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.
iops
integer
Guaranteed input/output storage requests per second (IOPS) available to the database system.
This parameter is updatable.
is_regionally_durable
boolean
    Choices:
  • no
  • yes
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.
system_type
string
    Choices:
  • OCI_OPTIMIZED_STORAGE
Type of the database system.
system_type
string
Type of the database system.
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 db_system
  oci_psql_db_system:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    db_version: db_version_example
    shape: shape_example
    network_details:
      # required
      subnet_id: "ocid1.subnet.oc1..xxxxxxEXAMPLExxxxxx"

      # optional
      primary_db_endpoint_private_ip: primary_db_endpoint_private_ip_example
      nsg_ids: [ "nsg_ids_example" ]
    display_name: display_name_example
    storage_details:
      # required
      system_type: OCI_OPTIMIZED_STORAGE
      is_regionally_durable: true

      # optional
      availability_domain: Uocm:PHX-AD-1
      iops: 56

    # optional
    system_type: system_type_example
    config_id: "ocid1.config.oc1..xxxxxxEXAMPLExxxxxx"
    instance_ocpu_count: 56
    instance_memory_size_in_gbs: 56
    instance_count: 56
    instances_details:
    - # optional
      display_name: display_name_example
      description: description_example
      private_ip: private_ip_example
    credentials:
      # required
      username: username_example
      password_details:
        # required
        password: example-password
        password_type: PLAIN_TEXT
    source:
      # required
      backup_id: "ocid1.backup.oc1..xxxxxxEXAMPLExxxxxx"
      source_type: BACKUP

      # optional
      is_having_restore_config_overrides: true
    description: description_example
    management_policy:
      # optional
      maintenance_window_start: maintenance_window_start_example
      backup_policy:
        # required
        kind: DAILY
        backup_start: backup_start_example

        # optional
        retention_days: 56
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update db_system
  oci_psql_db_system:
    # required
    db_system_id: "ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    display_name: display_name_example
    description: description_example
    db_configuration_params:
      # required
      config_id: "ocid1.config.oc1..xxxxxxEXAMPLExxxxxx"

      # optional
      apply_config: RESTART
    management_policy:
      # optional
      maintenance_window_start: maintenance_window_start_example
      backup_policy:
        # required
        kind: DAILY
        backup_start: backup_start_example

        # optional
        retention_days: 56
    storage_details:
      # required
      system_type: OCI_OPTIMIZED_STORAGE
      is_regionally_durable: true

      # optional
      availability_domain: Uocm:PHX-AD-1
      iops: 56
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update db_system using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_psql_db_system:
    # required
    display_name: display_name_example

    # optional
    description: description_example
    db_configuration_params:
      # required
      config_id: "ocid1.config.oc1..xxxxxxEXAMPLExxxxxx"

      # optional
      apply_config: RESTART
    management_policy:
      # optional
      maintenance_window_start: maintenance_window_start_example
      backup_policy:
        # required
        kind: DAILY
        backup_start: backup_start_example

        # optional
        retention_days: 56
    storage_details:
      # required
      system_type: OCI_OPTIMIZED_STORAGE
      is_regionally_durable: true

      # optional
      availability_domain: Uocm:PHX-AD-1
      iops: 56
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Delete db_system
  oci_psql_db_system:
    # required
    db_system_id: "ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

- name: Delete db_system using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_psql_db_system:
    # required
    display_name: display_name_example
    state: absent

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)