We announced the availability of Ansible modules and playbooks to automate deployments on Oracle Private Cloud Appliance in this blog.
In this blog, we would see how you can use Ansible to automate the deployment of Oracle DB 18c on PCA.
The following are the prerequisites for automating the installation of Oracle Database 18c on Oracle Private Cloud Appliance 2.3.1 and newer.
- Ansible Control Machine - The central machine where Ansible is installed. It is an Oracle Linux 7 system with Ansible package installed from ol7_developer_EPEL yum repository
- ovms_vm Ansible module – The module to automate cloning of VM Templates on PCA. This was released to the PCA User Group. The module can be also obtained from Gitlab
- Oracle VM Template for Oracle DB 18c – The latest VM templates for Oracle DB can be obtained from OTN
- Deploycluster tool 3.x – Avaible for download here on OTN
- Download the OVM Template for Oracle DB 18c
Get the Single Instance & Oracle RAC 18c Enterprise/Standard Edition, including Oracle Grid Infrastructure Release Update (22.214.171.124.181016) & Oracle Linux 7 Update 5 from OTN https://www.oracle.com/technetwork/server-storage/vm/database-templates-12c-11gr2-1972804.html
- Import the Downloaded Templates to Private Cloud Appliance
Import the downloaded templates to the desired repository on Private Cloud Appliance by using the Oracle VM Manager GUI. Once in the OVM Manager GUI, follow these steps:
- Click on Repositories
- Select the desired repository, then choose VM Templates
- Click on ‘Import VM Template’ ( button). Enter the URL for the VM template location
- Click OK
- Create a Clone Customizer
A clone customizer is used to set up the clone parameters, such as networking, and the virtual disk, and ISO resources. After importing the VM template to the desired repository, create a Clone Customizer by following these steps:
- Click on Repositories and Select the desired repository, then choose VM Templates
- Select the newly imported VM Template for DB 18c and click Manage Clone Customizers ( button)
- From the Manage Clone Customizers dialog box, click on Create Clone Customizer button
- Type a Name, check the Storage and Network mappings for the VM Template.
Note: For Single Instance DB, A single network adapter (NIC) and no extra disks are needed.
- Use Ansible to Clone the VM Template to Create VM
To learn how Ansible can be used to automate deployments on Private Cloud Appliance, read this whitepaper. This step will use the ovms_vm module (mentioned in the prerequisites section above).
Here is the sample playbook ‘sonit.yml’ used to Clone a DB VM from the template on PCA using ovms_vm module
When you execute this playbook, you see that Ansible clones the DB template to create a VM called ‘PCA-DB-VMTemplate’ as specified by us in the playbook. This is indicated by the screenshot of Ansible Control Machine below.
The playbook is executed using:
[root@ansible_cm ansible]# ansible-playbook sonit.yml
We can also see that newly created VM ‘PCA-DB-VMTemplate’ is running on the desired server pool on PCA. This step took around 9 minutes.
- Download Deploycluster tool
Obtain the latest version of the deploycluster tool from OTN (must accept license agreement): https://www.oracle.com/technetwork/server-storage/vm/database-templates-12c-11gr2-1972804.html
Use Deploycluster tool 3.x for deployment on PCA 2.3.1 and above. Refer to the Deploycluster documentation for details on how to extract and run the deploycluster tool.
In this setup, we would unzip the Deploycluster tool on the Master Management Node of Oracle Private Cloud Appliance. The deploycluster tool needs a Netconfig.ini file for specifying the names and IPs of the DB nodes to act on. Here is the netconfig file used in this setup.
Then execute the Deploycluster tool with the following command.
[root@MN]# ./deploycluster.py –u admin –p **** -I –M PCA-DB-VMTemplate –N netconfig-PCA-si.ini
We see that Deploycluster finishes configuring the database VM in 23 seconds.
Thus, the end-to-end single instance DB 18c deployment finished in ~9.5 minutes.