def main(): logger = oci_utils.get_logger("oci_database") set_logger(logger) module_args = oci_utils.get_taggable_arg_spec(supports_wait=True) module_args.update(dict( database_id=dict(type='str', required=True, aliases=['id']), database_scn=dict(type='str', required=False), latest=dict(type=bool, required=False), timestamp=dict(type='str', required=False), db_backup_config=dict(type=dict, required=False), state=dict(type='str', required=False, default='update', choices=['restore', 'update']) )) module = AnsibleModule( argument_spec=module_args ) if not HAS_OCI_PY_SDK: module.fail_json(msg='oci python sdk required for this module') db_client = DatabaseClient(oci_utils.get_oci_config(module)) state = module.params['state'] if state == 'restore': result = restore_database(db_client, module) elif state == 'update': result = update_database(db_client, module) module.exit_json(**result)
def main(): logger = oci_utils.get_logger("oci_db_node_facts") set_logger(logger) module_args = oci_utils.get_common_arg_spec() module_args.update(dict( compartment_id=dict(type='str', required=False), db_node_id=dict(type='str', required=False, aliases=['id']), db_system_id=dict(type='str', required=False) )) module = AnsibleModule( argument_spec=module_args, mutually_exclusive=[ ['compartment_id', 'db_node_id'], ['db_system_id', 'db_node_id'] ] ) if not HAS_OCI_PY_SDK: module.fail_json(msg='oci python sdk required for this module') oci_config = oci_utils.get_oci_config(module) db_client = DatabaseClient(oci_config) result = list_db_nodes(db_client, module) module.exit_json(**result)
def set_connect(self, secret_data): self.identity_client = IdentityClient(secret_data) self.database_client = DatabaseClient(secret_data) self.disk_client = BlockstorageClient(secret_data) self.compute_client = ComputeClient(secret_data) self.compute_management_client = ComputeManagementClient(secret_data) self.virtual_network_client = VirtualNetworkClient(secret_data) self.load_balancer_client = LoadBalancerClient(secret_data) self.network_load_balancer_client = NetworkLoadBalancerClient(secret_data)
def main(): logger = oci_utils.get_logger("oci_db_version_facts") set_logger(logger) module_args = oci_utils.get_common_arg_spec() module_args.update( dict(compartment_id=dict(type='str', required=True), db_system_shape=dict(type='str', required=False))) module = AnsibleModule(argument_spec=module_args) if not HAS_OCI_PY_SDK: module.fail_json(msg='oci python sdk required for this module') oci_config = oci_utils.get_oci_config(module) db_client = DatabaseClient(oci_config) result = list_db_versions(db_client, module) module.exit_json(**result)
def main(): logger = oci_utils.get_logger("oci_db_node") set_logger(logger) module_args = oci_utils.get_common_arg_spec(supports_wait=True) module_args.update( dict(db_node_id=dict(type='str', required=True, aliases=['id']), state=dict(type='str', required=False, default='start', choices=['stop', 'start', 'reset', 'softreset']))) module = AnsibleModule(argument_spec=module_args) if not HAS_OCI_PY_SDK: module.fail_json(msg='oci python sdk required for this module') db_client = DatabaseClient(oci_utils.get_oci_config(module)) result = perform_db_node_action(db_client, module) module.exit_json(**result)
def main(): logger = oci_utils.get_logger("oci_data_guard_association") set_logger(logger) module_args = oci_utils.get_common_arg_spec(supports_create=True, supports_wait=True) module_args.update(dict( database_id=dict(type='str', required=True), data_guard_association_id=dict( type='str', required=False, aliases=['id']), creation_type=dict(type='str', required=False, default='ExistingDbSystem', choices=['ExistingDbSystem']), database_admin_password=dict(type='str', required=False, no_log=True), protection_mode=dict(type='str', required=False, choices=[ 'MAXIMUM_AVAILABILITY', 'MAXIMUM_PERFORMANCE', 'MAXIMUM_PROTECTION']), transport_type=dict(type='str', required=False, choices=['SYNC', 'ASYNC', 'FASTSYNC']), peer_db_system_id=dict(type='str', required=False), state=dict(type='str', required=False, default='present', choices=['present', 'switchover', 'failover', 'reinstate']) )) module = AnsibleModule(argument_spec=module_args) if not HAS_OCI_PY_SDK: module.fail_json(msg='oci python sdk required for this module') db_client = DatabaseClient(oci_utils.get_oci_config(module)) state = module.params['state'] if state == 'present': result = oci_utils.check_and_create_resource(resource_type='data_guard_association', create_fn=create_data_guard_association, kwargs_create={'db_client': db_client, 'module': module}, list_fn=db_client.list_data_guard_associations, kwargs_list={ 'database_id': module.params['database_id']}, module=module, model=get_creation_type_instance(module)) else: result = perform_data_guard_operations(db_client, module) module.exit_json(**result)
def main(): logger = oci_utils.get_logger("oci_backup") set_logger(logger) module_args = oci_utils.get_common_arg_spec(supports_create=True, supports_wait=True) module_args.update( dict(backup_id=dict(type='str', required=False, aliases=['id']), database_id=dict(type='str', required=False), display_name=dict(type='str', required=False), state=dict(type='str', required=False, default='present', choices=['present', 'absent']))) module = AnsibleModule(argument_spec=module_args) if not HAS_OCI_PY_SDK: module.fail_json(msg='oci python sdk required for this module') db_client = DatabaseClient(oci_utils.get_oci_config(module)) state = module.params['state'] if state == 'present': result = oci_utils.check_and_create_resource( resource_type='backup', create_fn=create_backup, kwargs_create={ 'db_client': db_client, 'module': module }, list_fn=db_client.list_backups, kwargs_list={'database_id': module.params.get('database_id')}, module=module, model=CreateBackupDetails()) elif state == 'absent': result = delete_backup(db_client, module) module.exit_json(**result)
def main(): logger = oci_utils.get_logger("oci_db_home") set_logger(logger) module_args = oci_utils.get_common_arg_spec( supports_create=True, supports_wait=True) module_args.update(dict( db_system_id=dict(type='str', required=False), db_home_id=dict(type='str', required=False, aliases=['id']), display_name=dict(type='str', required=False), source=dict(type='str', required=False, choices=[ 'DB_BACKUP', 'NONE'], default='NONE'), database=dict(type=dict, required=False), db_version=dict(type='str', required=False), patch_details=dict(type=dict, required=False), state=dict(type='str', required=False, default='present', choices=['present', 'absent']) )) module = AnsibleModule( argument_spec=module_args ) if not HAS_OCI_PY_SDK: module.fail_json(msg='oci python sdk required for this module') db_client = DatabaseClient(oci_utils.get_oci_config(module)) if os.environ.get('OCI_DB_MOCK') is not None: db_client.base_client.session.headers.update( {'opc-host-serial': 'FakeHostSerial'}) state = module.params['state'] if state == 'present': result = create_or_update_db_home(db_client, module) elif state == 'absent': result = delete_db_home(db_client, module) module.exit_json(**result)
def main(): logger = oci_utils.get_logger("oci_db_system") set_logger(logger) module_args = oci_utils.get_taggable_arg_spec(supports_create=True, supports_wait=True) module_args.update( dict(compartment_id=dict(type='str', required=False), db_system_id=dict(type='str', required=False, aliases=['id']), availability_domain=dict(type='str', required=False), backup_subnet_id=dict(type='str', required=False), cluster_name=dict(type='str', required=False), cpu_core_count=dict(type=int, required=False), data_storage_percentage=dict(type=int, required=False), database_edition=dict( type='str', required=False, choices=[ 'STANDARD_EDITION', 'ENTERPRISE_EDITION', 'ENTERPRISE_EDITION_EXTREME_PERFORMANCE', 'ENTERPRISE_EDITION_HIGH_PERFORMANCE' ]), state=dict(type='str', required=False, default='present', choices=['present', 'absent']), db_home=dict(type=dict, required=False), disk_redundancy=dict(type='str', required=False, choices=['HIGH', 'NORMAL']), display_name=dict(type='str', required=False), domain=dict(type='str', required=False), hostname=dict(type='str', required=False), initial_data_storage_size_in_gb=dict(type=int, required=False), data_storage_size_in_gbs=dict(type=int, required=False), license_model=dict( type='str', required=False, choices=['LICENSE_INCLUDED', 'BRING_YOUR_OWN_LICENSE']), node_count=dict(type=int, required=False), shape=dict(type='str', required=False), ssh_public_keys=dict(type=list, required=False), subnet_id=dict(type='str', required=False), purge_ssh_public_keys=dict(type=bool, required=False, default=True, choices=[True, False]), version=dict(type=dict, required=False))) module = AnsibleModule(argument_spec=module_args) if not HAS_OCI_PY_SDK: module.fail_json(msg='oci python sdk required for this module') db_client = DatabaseClient(oci_utils.get_oci_config(module)) if os.environ.get('OCI_DB_MOCK') is not None: db_client.base_client.session.headers.update( {'opc-host-serial': 'FakeHostSerial'}) state = module.params['state'] if state == 'present': result = launch_or_update_db_system(db_client, module) elif state == 'absent': result = delete_db_system(db_client, module) module.exit_json(**result)