oci_db_system - Launch,update and terminate a DB System in OCI Database Cloud Service.¶
New in version 2.5.
Synopsis¶
- Launch an OCI DB System
- Update an OCI DB System, if present, with a new display name
- Terminate an OCI DB System, if present.
- Since all operations of this module takes a long time, it is recommended to set the
wait
to False. Use oci_db_system_facts to check the status of the operation as a separate task.
Requirements¶
The below requirements are needed on the host that executes this module.
- python >= 2.6
- Python SDK for Oracle Cloud Infrastructure https://oracle-cloud-infrastructure-python-sdk.readthedocs.io
Parameters¶
Parameter | Choices/Defaults | Comments | |
---|---|---|---|
api_user |
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_OCID 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 |
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 |
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 |
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_type |
|
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. |
|
availability_domain |
The Availability Domain where the DB System is located.
|
||
backup_subnet_id |
The OCID of the backup network subnet the DB System is associated with. Applicable only to Exadata.
|
||
cluster_name |
Cluster name for Exadata and 2-node RAC DB Systems. The cluster name must begin with an an alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. The cluster name can be no longer than 11 characters and is not case sensitive.
|
||
compartment_id |
Identifier of the compartment under which this DB System would be created. Mandatory for create operation.
|
||
config_file_location |
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 |
Default: DEFAULT
|
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 . |
|
cpu_core_count |
The number of CPU cores to enable. For VM DB systems, the core count is inferred from the specific VM shape chosen, so this parameter is not used.
|
||
data_storage_percentage |
The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Specify 80 or 40. The default is 80 percent assigned to DATA storage. This is not applicable for VM based DB systems.
|
||
data_storage_size_in_gbs |
Size, in GBs, to which the currently attached storage needs to be scaled up to for VM based DB system. This must be greater than current storage size. Note that the total storage size attached will be more than what is requested, to account for REDO/RECO space and software volume. This option required only for update operation.
|
||
database_edition |
|
The Oracle Database Edition that applies to all the databases on the DB System. Exadata DB Systems and 2-node RAC DB Systems require ENTERPRISE_EDITION_EXTREME_PERFORMANCE.
|
|
db_home
required |
Details of the DB home to use for this database. DB home is a directory where Oracle database software is installed.
|
||
db_version
required |
A valid Oracle database version.
|
||
display_name |
The user-provided name of the database home.
|
||
database
required |
The details of the database to be created under the db home. Consists of the following options, ['admin_password' describes A strong password for SYS, SYSTEM, and PDB Admin. The password must be at least nine characters and contain at least two uppercase, two lowercase, two numbers, and two special characters. required - true], ['character_set' describes the character set for the database. The default is AL32UTF8. required - false],['freeform_tags' describes Free-form tags for this database. Each tag is a simple key-value pair with no predefined name, type, or namespace. required - false], ['defined_tags' describes Defined tags for this database. Each key is predefined and scoped to a namespace. required - false] ['db_backup_config' consists of the option 'auto_backup_enabled' to determine whether to configures automatic backups of the databse. required - false], ['db_name' describes the name of the database name. It must begin with an alphabetic character and can contain a maximum of eight alphanumeric characters. Special characters are not permitted. required - true],['db_workload' describes database workload type with allowed values OLTP and DSS.required - false], ['ncharacter_set' describes National character set for the database.The default is AL16UTF16. Allowed values are AL16UTF16 or UTF8. required - false],['pdb_name' describes pluggable database name.It must begin with an alphabetic character and can contain a maximum of eight alphanumeric characters. Special characters are notpermitted. Pluggable database should not be same as database name. required - false]
|
||
db_system_id |
Identifier of the existing DB System which required to be updated or terminated. Mandatory for terminate and update.
aliases: id |
||
defined_tags |
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm.
|
||
disk_redundancy |
|
The type of redundancy configured for the DB System. Normal is 2-way redundancy, recommended for test and development systems. High is 3-way redundancy, recommended for production systems.
|
|
display_name |
The user-friendly name for the DB System. It does not have to be unique.
|
||
domain |
A domain name used for the DB System. If the Oracle-provided Internet and VCN Resolver is enabled for the specified subnet, the domain name for the subnet is used. Hyphens (-) are not permitted.
|
||
force_create
bool |
|
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 |
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm.
|
||
hostname |
The host name for the DB System. The host name must begin with an alphabetic character and can contain a maximum of 30 alphanumeric characters, including hyphens (-).The maximum length of the combined hostname and domain is 63 characters. The hostname must be unique within the subnet. If it is not unique, the DB System will fail to provision.
|
||
initial_data_storage_size_in_gb |
Size, in GBs, of the initial data volume that will be created and attached to VM-shape based DB system. This storage can later be scaled up if needed. Note that the total storage size attached will be more than what is requested, to account for REDO/RECO space and software volume.
|
||
key_by |
The list of comma-separated attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource except freeform_tags are used to uniquely identify a resource.
|
||
license_model |
|
The Oracle license model that applies to all the databases on the DB System. The default is LICENSE_INCLUDED.
|
|
node_count |
Number of nodes to launch for a VM-shape based RAC DB system.
|
||
purge_ssh_public_keys |
yes
|
Purge ssh public keys from DB System which are not present in the provided ssh public keys. If purge_ssh_public_keys=no, provided ssh public keys would be appended to existing ssh public keys.
|
|
region |
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 |
The shape of the DB System. The shape determines resources allocated to the DB System - CPU cores and memory for VM shapes; CPU cores, memory and storage for non-VM (or bare metal) shapes.
|
||
ssh_public_keys
required |
The public key portion of the key pair to use for SSH access to the DB System. Multiple public keys can be provided. The length of the combined keys cannot exceed 10,000 characters.
|
||
state |
|
Launch,update or terminate DB System. For state=present, if it does not exist, it gets created. If it exists, it gets updated.
|
|
subnet_id |
The OCID of the subnet the DB System is associated with.
|
||
tenancy |
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 |
||
version |
This attribute describes the patch version and what actions to perform with that on specified DB system. This is required only for update use case.
|
||
action
required |
|
The action to perform on the patch.
|
|
patch_id
required |
The OCID of the patch.
|
||
wait
bool |
|
Whether to wait for create or delete operation to complete.
|
|
wait_timeout |
Default: 1200
|
Time, in seconds, to wait when wait=yes.
|
|
wait_until |
The lifecycle state to wait for the resource to transition into when wait=yes. By default, when wait=yes, we wait for the resource to get into ACTIVE/ATTACHED/AVAILABLE/PROVISIONED/ RUNNING applicable lifecycle state during create operation & to get into DELETED/DETACHED/ TERMINATED lifecycle state during delete operation.
|
Notes¶
Note
- For OCI python sdk configuration, please refer to https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/configuration.html
Examples¶
# Note: These examples do not set authentication details.
# Launch DB System
- name: Create DB System
oci_db_system:
compartment_id: "ocid1.compartment.aaaa"
availability_domain: "AD-2"
cluster_name: "db-cluster"
cpu_core_count: 2
data_storage_percentage: 80
database_edition: "STANDARD_EDITION"
db_home:
database:
admin_password: 'BEstr0ng_#1'
character_set: 'AL32UTF8'
db_backup_config:
auto_backup_enabled: False
db_name: 'db15'
db_workload: 'OLTP'
ncharacter_set: 'AL16UTF16'
pdb_name: 'db15'
freeform_tags:
deployment: 'production'
defined_tags:
target_users:
division: 'design'
db_version: '12.2.0.1'
display_name: ansible-db-{{random_suffix_1024}}
disk_redundancy: "NORMAL"
display_name: "ansibledb"
hostname: "ansibledbsystem"
initial_data_storage_size_in_gb: 4096
license_model: "LICENSE_INCLUDED"
node_count: 1
shape: "BM.DenseIO1.36"
ssh_public_keys: ["/tmp/id_rsa.pub"]
subnet_id: "ocid1.subnet.aaaa"
freeform_tags:
deployment: 'production'
defined_tags:
target_users:
division: 'documentation'
wait: False
state: 'present'
# Perform a patch PRECHECK on the specified database system
- name: PRECHECK a patch on the DB System
oci_db_system:
db_system_id: "ocid1.dbsystem.aaaa"
version:
patch_id: "ocid1.patch.aaaa"
action: 'PRECHECK'
state: 'present'
# APPLY a patch on the specified database system
- name: APPLY a patch on the DB System
oci_db_system:
db_system_id: "ocid1.dbsystem.aaaa"
version:
patch_id: "ocid1.patch.aaaa"
action: 'APPLY'
state: 'present'
# Update a DB System's CPU core count
- name: Update DB System CPU core count
oci_db_system:
db_system_id: "ocid1.dbsystem.aaaa"
cpu_core_count: 4
state: 'present'
# Update DB System by purging SSH Public keys
- name: Update DB System by purging SSH Public keys
oci_db_system:
db_system_id: "ocid1.dbsystem.aaaa"
ssh_public_keys: ["/tmp/id_rsa_updated.pub"]
purge_ssh_public_keys: True
state: 'present'
# Appending SSH public keys to a database system
- name: Update DB System by appending SSH Public keys
oci_db_system:
db_system_id: "ocid1.dbsystem.aaaa"
ssh_public_keys: ["/tmp/id_rsa_updated.pub"]
purge_ssh_public_keys: False
state: 'present'
# Terminate DB System
- name: Terminate DB System
oci_db_system:
db_system_id: "ocid1.dbsystem.aaaa"
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
|
success |
Attributes of the launched/updated DB System. For delete, deleted DB System description will be returned.
Sample:
{'domain': 'ansiblevcn955.ansiblevcn955.oraclevcn.com', 'backup_subnet_id': None, 'reco_storage_size_in_gb': None, 'database_edition': 'STANDARD_EDITION', 'time_created': '2018-02-10T19:21:44.171000+00:00', 'shape': 'BM.DenseIO1.36', 'disk_redundancy': 'NORMAL', 'last_patch_history_entry_id': None, 'license_model': 'LICENSE_INCLUDED', 'lifecycle_details': None, 'data_storage_size_in_gbs': None, 'id': 'ocid1.dbsystem.oc1.iad.xxxxxEXAMPLExxxxx', 'listener_port': 1521, 'lifecycle_state': 'PROVISIONING', 'availability_domain': 'IwGV:US-ASHBURN-AD-2', 'display_name': 'ansible-db-system-955', 'data_storage_percentage': 80, 'compartment_id': 'ocid1.compartment.oc1..xxxxxEXAMPLExxxxx', 'subnet_id': 'ocid1.subnet.oc1.iad.xxxxxEXAMPLExxxxx', 'defined_tags': {'target_users': {'division': 'accounts'}}, 'hostname': 'db-system-955', 'freeform_tags': {'deployment': 'production'}, 'ssh_public_keys': ['ssh-rsa AAA'], 'vip_ids': None, 'cluster_name': 'db-clus-955', 'scan_ip_ids': None, 'version': None, 'cpu_core_count': 2, 'scan_dns_record_id': None, 'node_count': None}
|
|
domain
string
|
always |
The domain name for the DB System.
Sample:
ansiblevcn955.ansiblevcn955.oraclevcn.com
|
|
data_storage_percentage
string
|
always |
The percentage assigned to DATA storage
Sample:
80
|
|
reco_storage_size_in_gb
string
|
always |
RECO/REDO storage size, in GBs, that is currently allocated to the DB system. This is applicable only for VM-based DBs.
Sample:
1024
|
|
database_edition
string
|
always |
The Oracle Database Edition that applies to all the databases on the DB System.
Sample:
STANDARD_EDITION
|
|
time_created
datetime
|
always |
Date and time when the DB System was created, in the format defined by RFC3339
Sample:
2016-08-25 21:10:29.600000
|
|
shape
string
|
always |
The shape of the DB System
Sample:
BM.DenseIO1.36
|
|
disk_redundancy
string
|
always |
The type of redundancy configured for the DB System.
Sample:
NORMAL
|
|
last_patch_history_entry_id
string
|
always |
The OCID of the last patch history. This is updated as soon as a patch operation is started.
Sample:
ocid1.lastpatchhistory.aaaa
|
|
license_model
string
|
always |
The Oracle license model that applies to all the databases on the DB System
Sample:
LICENSE_INCLUDED
|
|
lifecycle_details
string
|
always |
Additional information about the current lifecycle state.
Sample:
details
|
|
data_storage_size_in_gbs
string
|
always |
Data storage size, in GBs, that is currently available to the DB system. This is applicable only for VM-based DBs.
Sample:
2048
|
|
id
string
|
always |
The identifier of the DB System
Sample:
ocid1.dbsystem.oc1.xzvf..oifds
|
|
listener_port
string
|
always |
The port number configured for the listener on the DB System.
Sample:
1521
|
|
lifecycle_state
string
|
always |
The current state of the DB System.
Sample:
AVAILABLE
|
|
availability_domain
string
|
always |
The Availability Domain where the DB System is located.
Sample:
IwGV:US-ASHBURN-AD-2
|
|
display_name
string
|
always |
The user-friendly name for the DB System.
Sample:
ansible-db-system
|
|
compartment_id
string
|
always |
The identifier of the compartment containing the DB System
Sample:
ocid1.compartment.oc1.xzvf..oifds
|
|
subnet_id
string
|
always |
The OCID of the subnet the DB System is associated with.
Sample:
ocid1.subnet.aaaa
|
|
scan_dns_record_id
string
|
always |
The OCID of the DNS record for the SCAN IP addresses that are associated with the DB System.
Sample:
ocid.dnsrecord.aaaa
|
|
hostname
string
|
always |
The user-friendly name for the DB System.
Sample:
db-system
|
|
ssh_public_keys
string
|
always |
The public key portion of one or more key pairs used for SSH access to the DB System.
Sample:
['ssh-rsa 3NzaC1y']
|
|
vip_ids
string
|
always |
The OCID of the virtual IP (VIP) addresses associated with the DB System.
Sample:
['159.28.0.1']
|
|
cluster_name
string
|
always |
Cluster name for Exadata and 2-node RAC DB Systems
Sample:
db-cluster
|
|
scan_ip_ids
string
|
always |
The OCID of the Single Client Access Name (SCAN) IP addresses associated with the DB System. SCAN IP addresses are typically used for load balancing and are not assigned to any interface. Clusterware directs the requests to the appropriate nodes in the cluster. For a single-node DB System, this list is empty.
Sample:
ocid1.scanip.aaaa
|
|
version
string
|
always |
The version of the DB System.
Sample:
12.2.0.1
|
|
cpu_core_count
string
|
always |
The number of CPU cores to enable.
Sample:
2
|
|
node_count
string
|
always |
Number of nodes in this DB system. For RAC DBs, this will be greater than 1.
Sample:
2
|
Status¶
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
Author¶
- Debayan Gupta(@debayan_gupta)
Hint
If you notice any issues in this documentation you can edit this document to improve it.